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

Description:
  • The error code
Source:
The error code
Type:
  • String

meta :Object

Description:
  • Metadata describing the error
Source:
Metadata describing the error
Type:
  • Object

statusCode :String

Description:
  • The HTTP status code
Source:
The HTTP status code
Type:
  • String

Methods

setData(data) → {AdaptError}

Description:
  • Chainable function to allow setting of data for use in user-friendly error messages later on.
Source:
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: