Error

Moduleejs
Definitiondynamic class Error
InheritanceError inherit Object
StabilityEvolving.

Error exception object and base class.

Exception objects are created by the system as part of changing the normal flow of execution when some error condition occurs.

When an exception is triggered and acted upon ("thrown"), the system transfers the flow of control to a pre-defined instruction stream (the handler or "catch" code). The handler may return processing to the point execution block where the exception was thrown. It may re-throw the exception or pass control up the call stack for an outer handler to process.


Properties

QualifiersPropertyTypeDescription
codeNumberOptional error code.
dataObjectSupplemental error data (.
get filenamePathSource filename of the script that created the error.
get linenoNumberSource line number in the script that created the error.
messageStringError message.
stackArrayCallback stack.
timestampDateTime the event was created. The Context constructor will automatically set the timestamp to the current time.

Error Class Methods

QualifiersMethod
static capture(uplevels: Number = 0): Array
 Capture the stack.

Error Instance Methods

QualifiersMethod
Error(message: String = null)
 Construct a new Error object.
formatStack(): String
 Format the captured stack.

Method Detail

Error(message: String = null)
Description
Construct a new Error object.
Parameters
message: String Message to use when defining the Error.message property. Typically a string but can be an object of any type. 8. [default: null]

static capture(uplevels: Number = 0): Array
Description
Capture the stack. This call captures the stack and returns an Array describing the current stack frame.
Parameters
uplevels: Number Skip a given count of stack frames from the stop of the call stack. [default: 0]

formatStack(): String
Description
Format the captured stack.
Returns
A string containing the formatted stack backtrace. Format is: [INDEX FILENAME, line LINENO, FUNCTION, CODE_LINE].