Constructor
new ResponseErrorOptions(optionsopt, fallbackCodeopt, fallbackMessageopt)
ResponseErrorOptions constructor
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options | Options | | <optional> | {} | Error options or error message |
fallbackCode | number | | <optional> | 500 | Fallback error code. Used if it is not exists in options, or it could not be converted in a number |
fallbackMessage | string | <optional> | 'Internal Server Error' | Fallback error message. Used if it is not exists in options, or it is not a string. |
- Source
Members
code
Get the code
details
Get the details
message
Get the message
options
Get the options
requestId
Get the request id
Methods
reset() → {ResponseErrorOptions}
Reset the options to the default values
Returns:
- Type:
- ResponseErrorOptions
toJSON() → {Options}
Plain object representation of the options
Returns:
- Type:
- Options
(static) defaultOptions() → {Options}
Default options
- Source
Returns:
- Type:
- Options
(static) parseCode(code, fallbacks) → {number|string}
Normalize the code and use the fallbacks if the code is empty or is not a number
Parameters:
Name | Type | Description |
---|---|---|
code | string | | Error code |
fallbacks | Array.<string> | | Fallback error codes |
- Source
Returns:
- Type:
- number |
string