@uzelux/error-collection

1.0.3 • Public • Published

#Error Collection

A collection of commonly used errors

##Properties The Error Objects extending from BaseError will contain the following properties

Name Description
name Error Type Name
message Error Message
code Error Code
location The location where the Error is thrown

##Usage

HTTP Errors

const { HttpError } = require('ErrorCollection');

throw HttpError.BadRequest(param = {})
throw HttpError.Unauthorized()
throw HttpError.Unauthenticated()
throw HttpError.PaymentRequired()
throw HttpError.Forbidden()
throw HttpError.NotFound(recordName = 'resource', query = {})
throw HttpError.MethodNotAllowed(method = null)
throw HttpError.NotAcceptable(contentType = null)
throw HttpError.ProxyAuthenticationRequired()
throw HttpError.RequestTimeout()
throw HttpError.Conflict()
throw HttpError.Gone()
throw HttpError.LengthRequired()
throw HttpError.PreconditionFailed(condition = null)
throw HttpError.PayloadTooLarge()
throw HttpError.UriTooLong(length = null)
throw HttpError.UnsupportedMediaType(mediaType = null)
throw HttpError.RequestedRangeNotSatisfiable(range = null)
throw HttpError.ExpectationFailed(failed = {})
throw HttpError.imaTeapot()
throw HttpError.MisdirectedRequest()
throw HttpError.UnprocessableEntity()
throw HttpError.Locked()
throw HttpError.FailedDependency()
throw HttpError.TooEarly()
throw HttpError.UpgradeRequired(targetProtocol = null)
throw HttpError.PreconditionRequired(condition = {})
throw HttpError.TooManyRequests()
throw HttpError.RequestHeaderFieldsTooLarge(headers = {})
throw HttpError.UnavailableForLegalReasons()
throw HttpError.InternalServerError(message = 'Unexpected Error')
throw HttpError.NotImplemented(method = null)
throw HttpError.BadGateway(resource = {})
throw HttpError.ServiceUnavailable()
throw HttpError.GatewayTimeout(resource = {})
throw HttpError.HttpVersionNotSupported(expectedVersion = '1.1')
throw HttpError.VariantAlsoNegotiates(variant = {})
throw HttpError.InsufficientStorage()
throw HttpError.LoopDetected()
throw HttpError.NotExtended()
throw HttpError.NetworkAuthenticationRequired()

Readme

Keywords

Package Sidebar

Install

npm i @uzelux/error-collection

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

25.1 kB

Total Files

13

Last publish

Collaborators

  • uzelux