1.1.1 • Published 5 years ago

@argodigital/formula-errors v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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')