0.2.0 • Published 5 years ago

@brunoluiz/jsonapi-errors v0.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

JSONAPI Errors

Common JSONAPI errors to use in your project.

Usage

All errors accept a message as input parameter and this will be used as the jsonapi error description field.

const { NotFoundError } = require('@brunoluiz/jsonapi-errors')

throw new NotFoundError('Not found error details');

Available errors and titles

  • 400 IdMismatchError: Parameter from path do not match with body
  • 400 MissingArgumentError: Missing argument
  • 401 UnauthorizedError: Not authorized
  • 403 ForbiddenError: Not allowed
  • 404 NotFoundError: Resource not found
  • 405 MethodNotAllowedError: Requested method is not allowed
  • 406 NotAcceptableTypeError
  • 409 ConflictError: Duplicated resource
  • 415 UnsupportedMediaTypeError: Content-Type: application/vnd.api+json doesn't accept media type parameters
  • 500 DatabaseError: Database internal error
  • 501 NotImplementedError: Request not implemented