1.0.7 • Published 5 years ago

@appify/http-errors v1.0.7

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

@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')
}
1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago