@argodigital/formula-errors
v1.1.1
Published
API errors for *formula* services.
Downloads
9
Maintainers
Keywords
Readme
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')