An error, used to represent an error state.
Many API's within SproutCore will return an instance of this object whenever they have an error occur. An error includes an error code, description, and optional human readable label that indicates the item that failed.
Depending on the error, other properties may also be added to the object to help you recover from the failure.
You can pass error objects to various UI elements to display the error in
the interface. You can easily determine if the value returned by some API is
an error or not using the helper
Faking Error Objects
You can actually make any object you want to be treated like an Error object
by simply implementing two properties:
errorValue. If you
YES, then calling
SC.ok(obj) on your object will return NO.
isError is YES, then
SC.val(obj) will return your
instead of the receiver.
SC.T_ERROR will only be returned if the obj
is an instance of
Defined in: error.js
- SproutCore 1.0
Field Detailcode Number
The value the error represents. This is used when wrapping a value inside of an error to represent the validation failure.
Human readable description of the error. This can also be a non-localized key.
Instance Method Detail
The original error object. Normally this will return the receiver. However, sometimes another object will masquerade as an error; this gives you a way to get at the underlying error.