Error
Module | ejs |
Definition | dynamic class Error |
Inheritance | Error ![]() |
Stability | Evolving. |
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
Qualifiers | Property | Type | Description |
---|---|---|---|
code | Number | Optional error code. | |
data | Object | Supplemental error data (. | |
get | filename | Path | Source filename of the script that created the error. |
get | lineno | Number | Source line number in the script that created the error. |
message | String | Error message. | |
stack | Array | Callback stack. | |
timestamp | Date | Time the event was created. The Context constructor will automatically set the timestamp to the current time. |
Error Class Methods
Qualifiers | Method |
---|---|
static | capture(uplevels: Number = 0): Array |
Capture the stack. |
Error Instance Methods
Qualifiers | Method |
---|---|
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]
- 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].