AdaptError

errors. AdaptError

A generic error class for use in Adapt applications

Constructor

new AdaptError(code, statusCode, metadata)

Source:
Parameters:
Name Type Default Description
code string The human-readable error code
statusCode number 500 The HTTP status code
metadata object Metadata describing the error

Members

code :String

Source:
The error code
Type:
  • String

meta :Object

Source:
Metadata describing the error
Type:
  • Object

statusCode :String

Source:
The HTTP status code
Type:
  • String

Methods

setData(data) → {AdaptError}

Source:
Chainable function to allow setting of data for use in user-friendly error messages later on.
Example
// note calling this function will also return
// the error itself to allow for easy error throwing
throw this.app.errors.MY_ERROR
  .setData({ hello: 'world' })
Parameters:
Name Type Description
data object
Returns:
Type
AdaptError

toString()

Source: