dartora

KeyException

KeyException indicates that a key used to access a map or another keyed data structure is invalid or not present. It extends BaseException and provides the offending key in its message.

Constructor

KeyException({ required Object key, String? message })

Message format

The info string passed to BaseException is:

"The key of `<key.toString()>` isn't a valid key."

name is set to 'KeyException', so the default toString() prints:

KeyException: The key of `<key>` isn't a valid key.
	Local Message: <message>

Usage

KeyException is thrown in LargeIterable.getItem() and LargeList.getItem() when a key does not exist within the current view. It can also be thrown by any custom code that validates keys before performing an operation.