ServiceError

Extends

code
Default: 500
message
Default: 'Internal Server Error'
new ServiceError(context)

Represents unexpected internal errors, those will be converted to ServiceError.
All ServiceError(s) are logged for later investigation and resolve to 500 Internal Server Error req response.

Parameters:
  • context optional
    • Type: Object or String
    • data in key-value format which will be included in an error log report (but excluded from any request response)

ServiceError.buildFrom(err, context)ServiceError
static

converts provided error to the ServiceError

Parameters:
  • err
    • Type: Error
  • context optional
    • Type: Object
    • additional ServiceError context object

Returns: ServiceError
setOrigin(id)ServiceError

set route origin of the error (where the error has been triggered).
the origin will be set automatically - this should be probably a private method?

Parameters:
  • id
    • Type: String
    • route uid

Returns: ServiceError
  • self
toLogger()Object

converts error to fromat intended for remote/file logging

Returns: Object
setUID(uid)
Parameters:
  • uid
    • Type: String or Integer
    • request indentifier

toJSON()Object
Returns: Object
toSwagger()Object

Open API schema representation of the error response

Returns: Object
comments powered by Disqus