Error
About
This is the base class for all errors thrown by js.component. Almost all errors thrown by this component will be instances of a subclass of Error
:
DBError
RangeError
ReferenceError
SyntaxError
SystemError
TypeError
API
constructor()
cs.js.Error.new({ message : Text { ; errorCode : Integer { ; options : Object }}})
cs.js.Error.new({ config : Object)
The first form passes the parameters to _.makeErrorConfig()
to construct the error configuration object. The second form simply uses the passed object as the error configuration object.
After assigning the properties of the error configuration object to the error object, the .name property is set to the name of the error class (which might be a subclass of Error
).
.code
.code : Text
The code of the line that triggered the error handler, or an empty string if you manually construct an Error
.
.description()
.description() : Text
Returns a description of the error, including the error name, error code, error message, and stack trace.
.error
.error : Integer
The 4D error code of the error that triggered the error handler, or the error code you pass to the constructor.
.line
.line : Integer
The line number of the method or function that triggered the error handler, or zero if you manually construct an Error
.
.message
.message : Text
The 4D error message of the error that triggered the error handler, or the error message you pass to the constructor.
.method
.method : Text
The path to the method or function where the error occurred, or an empty string if you manually construct an Error
.
.name
.name : Text
The class name of the error, which may be a subclass of Error
. This property is what is shown when you call Error.toString()
or Error.description()
. You can set this property to change the display name of the error.
.options
.options : Object
Returns an object for general use in storing arbitrary data in an Error
instance.
If you want to add arbitrary data to an Error
instance, you should do so by adding properties to this object rather than by creating your own properties on the instance itself. This will ensure you are not overwriting standard properties that exist now or in the future.
NOTE
.options.caught
is reserved for use by js.component.
.stack
.stack : Collection
The call chain starting at the point where the error was generated, or the point where you manually construct an Error
.
.stackTrace()
.stackTrace({ indent: Integer}) : Text
Returns a formatted stack trace of this instance’s stack, one frame per line.
If indent is passed, each line is prefixed with indent spaces. If indent is not passed, it defaults to 4 spaces.
Each line of the result in is the form:
<indent>at <host database name>.<method/class name>:<line number>
.toString()
.toString() : Text
Returns a summary of the error, including the error name, error code, and error message.