@appify/http-errors
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

@appify/http-errors

Exports http errors:

  • HttpError
  • BadRequest
  • BadRequestHttpError
  • Unauthorized
  • UnauthorizedHttpError
  • PaymentRequired
  • PaymentRequiredHttpError
  • Forbidden
  • ForbiddenHttpError
  • NotFound
  • NotFoundHttpError
  • MethodNotAllowed
  • MethodNotAllowedHttpError
  • NotAcceptable
  • NotAcceptableHttpError
  • ProxyAuthRequired
  • ProxyAuthRequiredHttpError
  • ClientTimeout
  • ClientTimeoutHttpError
  • Conflict
  • ConflictHttpError
  • Gone
  • GoneHttpError
  • PreconditionFailed
  • PreconditionFailedHttpError
  • UnsupportedMediaType
  • UnsupportedMediaTypeHttpError
  • ExpectationFailed
  • ExpectationFailedHttpError
  • UnprocessableEntity
  • UnprocessableEntityHttpError
  • Locked
  • LockedHttpError
  • PreconditionRequired
  • PreconditionRequiredHttpError
  • TooManyRequests
  • TooManyRequestsHttpError
  • InternalServerError
  • InternalServerErrorHttpError
  • NotImplemented
  • NotImplementedHttpError
  • BadGateway
  • BadGatewayHttpError
  • ServiceUnavailable
  • ServiceUnavailableHttpError
  • GatewayTimeout
  • GatewayTimeoutHttpError

Instalation

npm install @appify/http-errors

BaseError

const { HttpError } = require('@appify/http-errors');

try {
    throw new Error()
} catch (err) {
    throw new HttpError(500, 'SERVER_ERROR', 'Something went wrong', err.stack)
}

Semantic error

const { InternalServerError } = require('@appify/http-errors');

try {
    throw new TypeError()
} catch (err) {
    throw new InternalServerError('Told ya that type was wrong', 'TYPE_ERROR')
}

Readme

Keywords

Package Sidebar

Install

npm i @appify/http-errors

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

26.3 kB

Total Files

53

Last publish

Collaborators

  • rwillians