<abstract> new ExtensibleError(message [, dropInternalStackFrames])
Base class of custom error classes, extending the native Error
class.
This class has been introduced to fix the Babel-related issues with extending the native JavaScript (Error) classes.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
message |
string | The message describing the cause of the error. |
||
dropInternalStackFrames |
boolean |
<optional> |
true | Whether or not the call stack frames referring to the constructors of the custom errors should be excluded from the stack of this error (just like the native platform call stack frames are dropped by the JS engine). This flag is enabled by default. |
Extends
Members
-
_dropInternalStackFrames :boolean
-
Whether or not the call stack frames referring to the constructors of the custom errors should be excluded from the stack of this error (just like the native platform call stack frames are dropped by the JS engine).
Type:
- boolean
-
_nativeError :Error
-
Native error instance we use to generate the call stack. For some reason some browsers do not generate call stacks for instances of classes extending the native
Error
class, so we bypass this shortcoming this way.Type:
-
<nullable> _stack :string
-
The internal cache of the generated stack. The cache is filled upon first access to the
stack
property.Type:
- string
-
message :string
-
The message describing the cause of the error.
Type:
- string
-
name :string
-
The name of this error, used in the generated stack trace.
Type:
- string
Methods
-
getHttpStatus()
-
Returns the HTTP status to send to the client.
If the error has occurred at the client-side, the status code is used to determine the error page to show to the user.
This method is a shorthand for the following code snippet:
this.getParams().status || 500
.- Inherited From:
- See:
Returns:
The HTTP status to send to the client.
- Type
- number
-
getParams()
-
Returns the error parameters providing additional details about the error. The structure of the returned object is always situation-dependent, but the returned object usually contains the
status: number
field which represents the HTTP status to send to the client.- Inherited From:
- See:
-
- getHttpStatus
Returns:
The route parameters of the route at which the error has occurred.
- Type
- Object.<string, *>