@argodigital/formula-errors

1.1.1 • Public • Published

formula-errors

API errors for formula services.

Provides

Methods:

  • createApiError,
  • createJsonApiError

Objects (classes):

  • ApiError,
  • JsonApiError

Customization

Typical HTTP errors resolve name, code, message & statusCode attributes with help of statuses package. For example:

throw createApiError(404)

Builds following error object:

{
    message: 'Not Found',
    code: 'NotFound',
    docUrl: '',
    statusCode: 404,
    type: 'api_error'
}

Above will be also true with:

throw createApiError('NotFound')

To customize message and docUrl:

throw createApiError('NotFound', 'Could not find the user', 'http://argodigial.com/doc/user/registration')

Readme

Keywords

none

Package Sidebar

Install

npm i @argodigital/formula-errors

Weekly Downloads

0

Version

1.1.1

License

ISC

Unpacked Size

6.64 kB

Total Files

4

Last publish

Collaborators

  • argo-chulander
  • argo-digital-dev
  • argojade
  • baronswindle
  • benshimmin
  • heatherlorenzo
  • radociech
  • toby.jackson.argolimited