ResponseErrorOptions

ResponseErrorOptions class

Represents the options for the ResponseError class instantiation

Constructor

new ResponseErrorOptions(optionsopt, fallbackCodeopt, fallbackMessageopt)

ResponseErrorOptions constructor

Parameters:
NameTypeAttributesDefaultDescription
optionsOptions | object | string<optional>
{}

Error options or error message

fallbackCodenumber | string<optional>
500

Fallback error code. Used if it is not exists in options, or it could not be converted in a number

fallbackMessagestring<optional>
'Internal Server Error'

Fallback error message. Used if it is not exists in options, or it is not a string.

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

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:
NameTypeDescription
codestring | number

Error code

fallbacksArray.<string> | Array.<number> | number | string

Fallback error codes

Returns:
Type: 
number | string