NoSuchProp
Thrown to indicate that an object doesn't have expected properties.
- Source:
- NoSuchProp.js, line 8
Extends
ExceptionMembers
readonlyinfo any
Additional informations for debug.
- Inherited From:
- Exception#info
- Source:
- Exception.js, line 23
Methods
staticcheck(obj, …prop) → object
Checks if obj has prop as its property. If it doesn't, triggers an exception.
Otherwise, just returns obj.
The triggered exception holds obj and prop as .info.checked and .info.expected.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
obj |
object | The object to check |
|
prop |
string |
<repeatable> |
The property name to check if it exists |
- Source:
- NoSuchProp.js, line 33
Returns:
Just returns the obj argument if there's no problem
- Type:
- object
expects(prop) → boolean
Checks if prop is expected by this exception.
Parameters:
| Name | Type | Description |
|---|---|---|
prop |
string | Name of a property to check |
- Overrides:
- Exception#expects
- Source:
- NoSuchProp.js, line 14
Returns:
true if prop is expected
- Type:
- boolean
trigger() → any
Throws this exception if handler option is not set.
If handler option is set, calls it and returns the result.
- Inherited From:
- Exception#trigger
- Source:
- Exception.js, line 41
- See:
- Exception.option
Throws:
This exception
Returns:
The result of option.handler function
- Type:
- any