HttpError
Status

Table of Content
Purpose
HttpError class definition
Installation
Via npm
npm install @scuba-squad/http-error
API
HttpError(name: number | string)
Added in: v1.0.0
Factory method to get a HttpError class
arguments:
returns: HttpError
throws: TypeError
const errors = require('@scuba-squad/http-error');
const notFound = errors.HttpError(404);
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.HttpError('Not found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.HttpError('notfound');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.HttpError('not-found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.HttpError('not_found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
ClientError(name: number | string)
Added in: v1.0.0
Factory method to get a ClientError class
arguments:
returns: ClientError
throws: TypeError
const errors = require('@scuba-squad/http-error');
const notFound = errors.ClientError(404);
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.ClientError('Not found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.ClientError('notfound');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.ClientError('not-found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
const errors = require('@scuba-squad/http-error');
const notFound = errors.ClientError('not_found');
notFound instanceof Error;
notFound instanceof errors.HttpError;
notFound instanceof errors.ClientError;
notFound instanceof errors.ServerError;
notFound instanceof errors.NotFound;
ServerError(name: number | string)
Added in: v1.0.0
Factory method to get a ServerError class
arguments:
returns: ServerError
throws: TypeError
const errors = require('@scuba-squad/http-error');
const internalServerError = errors.ServerError(500);
internalServerError instanceof Error;
internalServerError instanceof errors.HttpError;
internalServerError instanceof errors.ClientError;
internalServerError instanceof errors.ServerError;
internalServerError instanceof errors.InternalServerError;
const errors = require('@scuba-squad/http-error');
const internalServerError = errors.ServerError('Internal Server Error');
internalServerError instanceof Error;
internalServerError instanceof errors.HttpError;
internalServerError instanceof errors.ClientError;
internalServerError instanceof errors.ServerError;
internalServerError instanceof errors.InternalServerError;
const errors = require('@scuba-squad/http-error');
const internalServerError = errors.ServerError('internalservererror');
internalServerError instanceof Error;
internalServerError instanceof errors.HttpError;
internalServerError instanceof errors.ClientError;
internalServerError instanceof errors.ServerError;
internalServerError instanceof errors.InternalServerError;
const errors = require('@scuba-squad/http-error');
const internalServerError = errors.ServerError('internal-server-error');
internalServerError instanceof Error;
internalServerError instanceof errors.HttpError;
internalServerError instanceof errors.ClientError;
internalServerError instanceof errors.ServerError;
internalServerError instanceof errors.InternalServerError;
const errors = require('@scuba-squad/http-error');
const internalServerError = errors.ServerError('internal_server_error');
internalServerError instanceof Error;
internalServerError instanceof errors.HttpError;
internalServerError instanceof errors.ClientError;
internalServerError instanceof errors.ServerError;
internalServerError instanceof errors.InternalServerError;
BadRequest(opt?: {message?: string = 'Please, correct your request and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
BadRequest class constructor
arguments:
message?: string = 'Please, correct your request and try again.'
debug?: any
cause?: any
returns: BadRequest
const {BadRequest} = require('@scuba-squad/http-errors');
const error = new BadRequest();
error instanceof BadRequest;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {BadRequest} = require('@scuba-squad/http-errors');
const error = BadRequest();
error instanceof BadRequest;
error.code;
error.status;
error.message;
Unauthorized(opt?: {message?: string = 'Please, authenticate and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
Unauthorized class constructor
arguments:
message?: string = 'Please, authenticate and try again.'
debug?: any
cause?: any
returns: BadRequest
const {Unauthorized} = require('@scuba-squad/http-errors');
const error = new Unauthorized();
error instanceof Unauthorized;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {Unauthorized} = require('@scuba-squad/http-errors');
const error = Unauthorized();
error instanceof Unauthorized;
error.code;
error.status;
error.message;
PaymentRequired(opt?: {message?: string = 'Payment is required to use this service.', debug?: any, cause?: any} = {})
Added in: v1.0.0
PaymentRequired class constructor
arguments:
message?: string = 'Payment is required to use this service.'
debug?: any
cause?: any
returns: BadRequest
const {PaymentRequired} = require('@scuba-squad/http-errors');
const error = new PaymentRequired();
error instanceof PaymentRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {PaymentRequired} = require('@scuba-squad/http-errors');
const error = PaymentRequired();
error instanceof PaymentRequired;
error.code;
error.status;
error.message;
Forbidden(opt?: {message?: string = 'You lack permission to preform this action.', debug?: any, cause?: any} = {})
Added in: v1.0.0
Forbidden class constructor
arguments:
message?: string = 'You lack permission to preform this action.'
debug?: any
cause?: any
returns: BadRequest
const {Forbidden} = require('@scuba-squad/http-errors');
const error = new Forbidden();
error instanceof Forbidden;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {Forbidden} = require('@scuba-squad/http-errors');
const error = Forbidden();
error instanceof Forbidden;
error.code;
error.status;
error.message;
NotFound(opt?: {message?: string = 'The requested document was not found.', debug?: any, cause?: any} = {})
Added in: v1.0.0
NotFound class constructor
arguments:
message?: string = 'The requested document was not found.'
debug?: any
cause?: any
returns: BadRequest
const {NotFound} = require('@scuba-squad/http-errors');
const error = new NotFound();
error instanceof NotFound;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {NotFound} = require('@scuba-squad/http-errors');
const error = NotFound();
error instanceof NotFound;
error.code;
error.status;
error.message;
MethodNotAllowed(opt?: {message?: string = 'Please, check your request method and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
MethodNotAllowed class constructor
arguments:
message?: string = 'Please, check your request method and try again.'
debug?: any
cause?: any
returns: BadRequest
const {MethodNotAllowed} = require('@scuba-squad/http-errors');
const error = new MethodNotAllowed();
error instanceof MethodNotAllowed;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {MethodNotAllowed} = require('@scuba-squad/http-errors');
const error = MethodNotAllowed();
error instanceof MethodNotAllowed;
error.code;
error.status;
error.message;
NotAcceptable(opt?: {message?: string = 'The requested document format is not supported.', debug?: any, cause?: any} = {})
Added in: v1.0.0
NotAcceptable class constructor
arguments:
message?: string = 'The requested document format is not supported.'
debug?: any
cause?: any
returns: BadRequest
const {NotAcceptable} = require('@scuba-squad/http-errors');
const error = new NotAcceptable();
error instanceof NotAcceptable;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {NotAcceptable} = require('@scuba-squad/http-errors');
const error = NotAcceptable();
error instanceof NotAcceptable;
error.code;
error.status;
error.message;
ProxyAuthenticationRequired(opt?: {message?: string = 'Please, authenticate with the proxy server and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
ProxyAuthenticationRequired class constructor
arguments:
message?: string = 'Please, authenticate with the proxy server and try again.'
debug?: any
cause?: any
returns: BadRequest
const {ProxyAuthenticationRequired} = require('@scuba-squad/http-errors');
const error = new ProxyAuthenticationRequired();
error instanceof ProxyAuthenticationRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {ProxyAuthenticationRequired} = require('@scuba-squad/http-errors');
const error = ProxyAuthenticationRequired();
error instanceof ProxyAuthenticationRequired;
error.code;
error.status;
error.message;
RequestTimeout(opt?: {message?: string = 'Sorry, it appears we are on break, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
RequestTimeout class constructor
arguments:
message?: string = 'Sorry, it appears we are on break, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {RequestTimeout} = require('@scuba-squad/http-errors');
const error = new RequestTimeout();
error instanceof RequestTimeout;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {RequestTimeout} = require('@scuba-squad/http-errors');
const error = RequestTimeout();
error instanceof RequestTimeout;
error.code;
error.status;
error.message;
Conflict(opt?: {message?: string = 'Houston, we have a conflict, please reload the resource and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
Conflict class constructor
arguments:
message?: string = 'Houston, we have a conflict, please reload the resource and try again.'
debug?: any
cause?: any
returns: BadRequest
const {Conflict} = require('@scuba-squad/http-errors');
const error = new Conflict();
error instanceof Conflict;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {Conflict} = require('@scuba-squad/http-errors');
const error = Conflict();
error instanceof Conflict;
error.code;
error.status;
error.message;
Gone(opt?: {message?: string = 'Sorry, but that resource has been removed.', debug?: any, cause?: any} = {})
Added in: v1.0.0
Gone class constructor
arguments:
message?: string = 'Sorry, but that resource has been removed.'
debug?: any
cause?: any
returns: BadRequest
const {Gone} = require('@scuba-squad/http-errors');
const error = new Gone();
error instanceof Gone;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {Gone} = require('@scuba-squad/http-errors');
const error = Gone();
error instanceof Gone;
error.code;
error.status;
error.message;
LengthRequired(opt?: {message?: string = 'Please, correct the Length header and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
LengthRequired class constructor
arguments:
message?: string = 'Please, correct the Length header and try again.'
debug?: any
cause?: any
returns: BadRequest
const {LengthRequired} = require('@scuba-squad/http-errors');
const error = new LengthRequired();
error instanceof LengthRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {LengthRequired} = require('@scuba-squad/http-errors');
const error = LengthRequired();
error instanceof LengthRequired;
error.code;
error.status;
error.message;
PreconditionFailed(opt?: {message?: string = 'Sorry, it appears 1 or more preconditions on the request have changed, please correct and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
PreconditionFailed class constructor
arguments:
message?: string = 'Sorry, it appears 1 or more preconditions on the request have changed, please correct and try again.'
debug?: any
cause?: any
returns: BadRequest
const {PreconditionFailed} = require('@scuba-squad/http-errors');
const error = new PreconditionFailed();
error instanceof PreconditionFailed;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {PreconditionFailed} = require('@scuba-squad/http-errors');
const error = PreconditionFailed();
error instanceof PreconditionFailed;
error.code;
error.status;
error.message;
PayloadTooLarge(opt?: {message?: string = 'Request payload is too large and can not be processed.', debug?: any, cause?: any} = {})
Added in: v1.0.0
PayloadTooLarge class constructor
arguments:
message?: string = 'Request payload is too large and can not be processed.'
debug?: any
cause?: any
returns: BadRequest
const {PayloadTooLarge} = require('@scuba-squad/http-errors');
const error = new PayloadTooLarge();
error instanceof PayloadTooLarge;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {PayloadTooLarge} = require('@scuba-squad/http-errors');
const error = PayloadTooLarge();
error instanceof PayloadTooLarge;
error.code;
error.status;
error.message;
URITooLong(opt?: {message?: string = 'Request uri is too large and can not be processed.', debug?: any, cause?: any} = {})
Added in: v1.0.0
URITooLong class constructor
arguments:
message?: string = 'Request uri is too large and can not be processed.'
debug?: any
cause?: any
returns: BadRequest
const {URITooLong} = require('@scuba-squad/http-errors');
const error = new URITooLong();
error instanceof URITooLong;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {URITooLong} = require('@scuba-squad/http-errors');
const error = URITooLong();
error instanceof URITooLong;
error.code;
error.status;
error.message;
UnsupportedMediaType(opt?: {message?: string = 'Please, try again with a different media format.', debug?: any, cause?: any} = {})
Added in: v1.0.0
UnsupportedMediaType class constructor
arguments:
message?: string = 'Please, try again with a different media format.'
debug?: any
cause?: any
returns: BadRequest
const {UnsupportedMediaType} = require('@scuba-squad/http-errors');
const error = new UnsupportedMediaType();
error instanceof UnsupportedMediaType;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {UnsupportedMediaType} = require('@scuba-squad/http-errors');
const error = UnsupportedMediaType();
error instanceof UnsupportedMediaType;
error.code;
error.status;
error.message;
RangeNotSatisfiable(opt?: {message?: string = 'Requested range is not satisfiable, please check Range and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
RangeNotSatisfiable class constructor
arguments:
message?: string = 'Requested range is not satisfiable, please check Range and try again.'
debug?: any
cause?: any
returns: BadRequest
const {RangeNotSatisfiable} = require('@scuba-squad/http-errors');
const error = new RangeNotSatisfiable();
error instanceof RangeNotSatisfiable;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {RangeNotSatisfiable} = require('@scuba-squad/http-errors');
const error = RangeNotSatisfiable();
error instanceof RangeNotSatisfiable;
error.code;
error.status;
error.message;
ExpectationFailed(opt?: {message?: string = 'Sorry, your expectation can not be meet, please check Expect and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
ExpectationFailed class constructor
arguments:
message?: string = 'Sorry, your expectation can not be meet, please check Expect and try again.'
debug?: any
cause?: any
returns: BadRequest
const {ExpectationFailed} = require('@scuba-squad/http-errors');
const error = new ExpectationFailed();
error instanceof ExpectationFailed;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {ExpectationFailed} = require('@scuba-squad/http-errors');
const error = ExpectationFailed();
error instanceof ExpectationFailed;
error.code;
error.status;
error.message;
IMATeapot(opt?: {message?: string = 'Tip me over, and pour me out.', debug?: any, cause?: any} = {})
Added in: v1.0.0
IMATeapot class constructor
arguments:
message?: string = 'Tip me over, and pour me out.'
debug?: any
cause?: any
returns: BadRequest
const {IMATeapot} = require('@scuba-squad/http-errors');
const error = new IMATeapot();
error instanceof IMATeapot;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {IMATeapot} = require('@scuba-squad/http-errors');
const error = IMATeapot();
error instanceof IMATeapot;
error.code;
error.status;
error.message;
MisdirectedRequest(opt?: {message?: string = 'Sorry, we got misdirected, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
MisdirectedRequest class constructor
arguments:
message?: string = 'Sorry, we got misdirected, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {MisdirectedRequest} = require('@scuba-squad/http-errors');
const error = new MisdirectedRequest();
error instanceof MisdirectedRequest;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {MisdirectedRequest} = require('@scuba-squad/http-errors');
const error = MisdirectedRequest();
error instanceof MisdirectedRequest;
error.code;
error.status;
error.message;
UnprocessableEntity(opt?: {message?: string = 'Sorry, it appears your document instructions are semantically erroneous.', debug?: any, cause?: any} = {})
Added in: v1.0.0
UnprocessableEntity class constructor
arguments:
message?: string = 'Sorry, it appears your document instructions are semantically erroneous.'
debug?: any
cause?: any
returns: BadRequest
const {UnprocessableEntity} = require('@scuba-squad/http-errors');
const error = new UnprocessableEntity();
error instanceof UnprocessableEntity;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {UnprocessableEntity} = require('@scuba-squad/http-errors');
const error = UnprocessableEntity();
error instanceof UnprocessableEntity;
error.code;
error.status;
error.message;
Locked(opt?: {message?: string = 'Document is currently locked, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
Locked class constructor
arguments:
message?: string = 'Document is currently locked, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {Locked} = require('@scuba-squad/http-errors');
const error = new Locked();
error instanceof Locked;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {Locked} = require('@scuba-squad/http-errors');
const error = Locked();
error instanceof Locked;
error.code;
error.status;
error.message;
FailedDependency(opt?: {message?: string = 'Sorry, it appears a dependent request has failed please retry previous dependent request and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
FailedDependency class constructor
arguments:
message?: string = 'Sorry, it appears a dependent request has failed please retry previous dependent request and try again.'
debug?: any
cause?: any
returns: BadRequest
const {FailedDependency} = require('@scuba-squad/http-errors');
const error = new FailedDependency();
error instanceof FailedDependency;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {FailedDependency} = require('@scuba-squad/http-errors');
const error = FailedDependency();
error instanceof FailedDependency;
error.code;
error.status;
error.message;
UpgradeRequired(opt?: {message?: string = 'Please, upgrade and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
UpgradeRequired class constructor
arguments:
message?: string = 'Please, upgrade and try again.'
debug?: any
cause?: any
returns: BadRequest
const {UpgradeRequired} = require('@scuba-squad/http-errors');
const error = new UpgradeRequired();
error instanceof UpgradeRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {UpgradeRequired} = require('@scuba-squad/http-errors');
const error = UpgradeRequired();
error instanceof UpgradeRequired;
error.code;
error.status;
error.message;
PreconditionRequired(opt?: {message?: string = 'Please, add preconditions to your request and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
PreconditionRequired class constructor
arguments:
message?: string = 'Please, add preconditions to your request and try again.'
debug?: any
cause?: any
returns: BadRequest
const {PreconditionRequired} = require('@scuba-squad/http-errors');
const error = new PreconditionRequired();
error instanceof PreconditionRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {PreconditionRequired} = require('@scuba-squad/http-errors');
const error = PreconditionRequired();
error instanceof PreconditionRequired;
error.code;
error.status;
error.message;
TooManyRequests(opt?: {message?: string = 'Sorry, you have exceeded your rate limit, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
TooManyRequests class constructor
arguments:
message?: string = 'Sorry, you have exceeded your rate limit, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {TooManyRequests} = require('@scuba-squad/http-errors');
const error = new TooManyRequests();
error instanceof TooManyRequests;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {TooManyRequests} = require('@scuba-squad/http-errors');
const error = TooManyRequests();
error instanceof TooManyRequests;
error.code;
error.status;
error.message;
RequestHeaderFieldsTooLarge(opt?: {message?: string = 'Request header is too large and can not be processed.', debug?: any, cause?: any} = {})
Added in: v1.0.0
RequestHeaderFieldsTooLarge class constructor
arguments:
message?: string = 'Request header is too large and can not be processed.'
debug?: any
cause?: any
returns: BadRequest
const {RequestHeaderFieldsTooLarge} = require('@scuba-squad/http-errors');
const error = new RequestHeaderFieldsTooLarge();
error instanceof RequestHeaderFieldsTooLarge;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {RequestHeaderFieldsTooLarge} = require('@scuba-squad/http-errors');
const error = RequestHeaderFieldsTooLarge();
error instanceof RequestHeaderFieldsTooLarge;
error.code;
error.status;
error.message;
UnavailableForLegalReasons(opt?: {message?: string = 'Due to legal reasons this resource has been removed.', debug?: any, cause?: any} = {})
Added in: v1.0.0
UnavailableForLegalReasons class constructor
arguments:
message?: string = 'Due to legal reasons this resource has been removed.'
debug?: any
cause?: any
returns: BadRequest
const {UnavailableForLegalReasons} = require('@scuba-squad/http-errors');
const error = new UnavailableForLegalReasons();
error instanceof UnavailableForLegalReasons;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {UnavailableForLegalReasons} = require('@scuba-squad/http-errors');
const error = UnavailableForLegalReasons();
error instanceof UnavailableForLegalReasons;
error.code;
error.status;
error.message;
InternalServerError(opt?: {message?: string = 'Sorry, it appears we had an unexpected error, please try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
InternalServerError class constructor
arguments:
message?: string = 'Sorry, it appears we had an unexpected error, please try again.'
debug?: any
cause?: any
returns: BadRequest
const {InternalServerError} = require('@scuba-squad/http-errors');
const error = new InternalServerError();
error instanceof InternalServerError;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {InternalServerError} = require('@scuba-squad/http-errors');
const error = InternalServerError();
error instanceof InternalServerError;
error.code;
error.status;
error.message;
NotImplemented(opt?: {message?: string = 'Sorry, this is not fully implemented, please try later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
NotImplemented class constructor
arguments:
message?: string = 'Sorry, this is not fully implemented, please try later.'
debug?: any
cause?: any
returns: BadRequest
const {NotImplemented} = require('@scuba-squad/http-errors');
const error = new NotImplemented();
error instanceof NotImplemented;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {NotImplemented} = require('@scuba-squad/http-errors');
const error = NotImplemented();
error instanceof NotImplemented;
error.code;
error.status;
error.message;
BadGateway(opt?: {message?: string = 'Sorry, It appears we received an error from another service that is needed to fulfill your request, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
BadGateway class constructor
arguments:
message?: string = 'Sorry, It appears we received an error from another service that is needed to fulfill your request, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {BadGateway} = require('@scuba-squad/http-errors');
const error = new BadGateway();
error instanceof BadGateway;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {BadGateway} = require('@scuba-squad/http-errors');
const error = BadGateway();
error instanceof BadGateway;
error.code;
error.status;
error.message;
ServiceUnavailable(opt?: {message?: string = 'Sorry, this service is currently unavailable, please try later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
ServiceUnavailable class constructor
arguments:
message?: string = 'Sorry, this service is currently unavailable, please try later.'
debug?: any
cause?: any
returns: BadRequest
const {ServiceUnavailable} = require('@scuba-squad/http-errors');
const error = new ServiceUnavailable();
error instanceof ServiceUnavailable;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {ServiceUnavailable} = require('@scuba-squad/http-errors');
const error = ServiceUnavailable();
error instanceof ServiceUnavailable;
error.code;
error.status;
error.message;
GatewayTimeout(opt?: {message?: string = 'Sorry, it appears another service is taking to long and we cannot wait any longer.', debug?: any, cause?: any} = {})
Added in: v1.0.0
GatewayTimeout class constructor
arguments:
message?: string = 'Sorry, it appears another service is taking to long and we cannot wait any longer.'
debug?: any
cause?: any
returns: BadRequest
const {GatewayTimeout} = require('@scuba-squad/http-errors');
const error = new GatewayTimeout();
error instanceof GatewayTimeout;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {GatewayTimeout} = require('@scuba-squad/http-errors');
const error = GatewayTimeout();
error instanceof GatewayTimeout;
error.code;
error.status;
error.message;
HTTPVersionNotSupported(opt?: {message?: string = 'Please, try a diffrent protocol version and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
HTTPVersionNotSupported class constructor
arguments:
message?: string = 'Please, try a diffrent protocol version and try again.'
debug?: any
cause?: any
returns: BadRequest
const {HTTPVersionNotSupported} = require('@scuba-squad/http-errors');
const error = new HTTPVersionNotSupported();
error instanceof HTTPVersionNotSupported;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {HTTPVersionNotSupported} = require('@scuba-squad/http-errors');
const error = HTTPVersionNotSupported();
error instanceof HTTPVersionNotSupported;
error.code;
error.status;
error.message;
VariantAlsoNegotiates(opt?: {message?: string = 'Sorry, it appears there is a misconfiguration on our end.', debug?: any, cause?: any} = {})
Added in: v1.0.0
VariantAlsoNegotiates class constructor
arguments:
message?: string = 'Sorry, it appears there is a misconfiguration on our end.'
debug?: any
cause?: any
returns: BadRequest
const {VariantAlsoNegotiates} = require('@scuba-squad/http-errors');
const error = new VariantAlsoNegotiates();
error instanceof VariantAlsoNegotiates;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {VariantAlsoNegotiates} = require('@scuba-squad/http-errors');
const error = VariantAlsoNegotiates();
error instanceof VariantAlsoNegotiates;
error.code;
error.status;
error.message;
InsufficientStorage(opt?: {message?: string = 'Sorry, it appears we have no more room for storage.', debug?: any, cause?: any} = {})
Added in: v1.0.0
InsufficientStorage class constructor
arguments:
message?: string = 'Sorry, it appears we have no more room for storage.'
debug?: any
cause?: any
returns: BadRequest
const {InsufficientStorage} = require('@scuba-squad/http-errors');
const error = new InsufficientStorage();
error instanceof InsufficientStorage;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {InsufficientStorage} = require('@scuba-squad/http-errors');
const error = InsufficientStorage();
error instanceof InsufficientStorage;
error.code;
error.status;
error.message;
LoopDetected(opt?: {message?: string = 'Sorry, We have detected an infintie loop and had to stop the request, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
LoopDetected class constructor
arguments:
message?: string = 'Sorry, We have detected an infintie loop and had to stop the request, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {LoopDetected} = require('@scuba-squad/http-errors');
const error = new LoopDetected();
error instanceof LoopDetected;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {LoopDetected} = require('@scuba-squad/http-errors');
const error = LoopDetected();
error instanceof LoopDetected;
error.code;
error.status;
error.message;
NotExtended(opt?: {message?: string = 'The policy for accessing this resource has not been met by this request.', debug?: any, cause?: any} = {})
Added in: v1.0.0
NotExtended class constructor
arguments:
message?: string = 'The policy for accessing this resource has not been met by this request.'
debug?: any
cause?: any
returns: BadRequest
const {NotExtended} = require('@scuba-squad/http-errors');
const error = new NotExtended();
error instanceof NotExtended;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {NotExtended} = require('@scuba-squad/http-errors');
const error = NotExtended();
error instanceof NotExtended;
error.code;
error.status;
error.message;
NetworkAuthenticationRequired(opt?: {message?: string = 'Please, authenticate with the network and try again.', debug?: any, cause?: any} = {})
Added in: v1.0.0
NetworkAuthenticationRequired class constructor
arguments:
message?: string = 'Please, authenticate with the network and try again.'
debug?: any
cause?: any
returns: BadRequest
const {NetworkAuthenticationRequired} = require('@scuba-squad/http-errors');
const error = new NetworkAuthenticationRequired();
error instanceof NetworkAuthenticationRequired;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {NetworkAuthenticationRequired} = require('@scuba-squad/http-errors');
const error = NetworkAuthenticationRequired();
error instanceof NetworkAuthenticationRequired;
error.code;
error.status;
error.message;
UnknownError(opt?: {message?: string = 'Sorry, an unexpected error has occured, please try again later.', debug?: any, cause?: any} = {})
Added in: v1.0.0
UnknownError class constructor
arguments:
message?: string = 'Sorry, an unexpected error has occured, please try again later.'
debug?: any
cause?: any
returns: BadRequest
const {UnknownError} = require('@scuba-squad/http-errors');
const error = new UnknownError();
error instanceof UnknownError;
error.code;
error.status;
error.message;
alternatively
- you can create an instance without the new keyword
const {UnknownError} = require('@scuba-squad/http-errors');
const error = UnknownError();
error instanceof UnknownError;
error.code;
error.status;
error.message;
Test
tests
npm install
npm test
License
MIT