1.0.0 • Published 7 years ago

imperfect v1.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

imperfect

A Technical Error Provider.

Usage

If you build a transport layer, ...

... you can implement the handling of the Technical Errors provided by imperfect,
so that when someone uses your layer, and an imperfect-Error ist thrown, you can handle it correctly

If you want to use imperfect-Errors, ...

... You can just use the Errors provided by imperfect directly, or write your own
non-technical errors that extend imperfect-Errors.

Every library (mostly transport layers) that can handle imperfect-Errors will be
able to also correctly handle Errors that extend a imperfect-Error

Either way

you just need to npm install --save imperfect,
and then require('imperfect').ERRORNAME,
where ERRORNAME is the name of one of the imperfect-Errors.

all imperfect-errors have the isTechnicalError-property, so they can be identified as imperfect-errors

Errors

The Errors are mostly based on http-status-codes.
Every Error, except for the BaseError directly extends BaseError, and
BaseError extends Error

namecode
BaseError
information-errors1xx
ContinueError101
SwitchingProtocolsError102
ProcessingError103
redirect-errors3xx
MultipleChoicesError300
MovedError301
FoundError302
SeeOtherError303
NotModifiedError304
UseProxyError305
TemporaryRedirectError307
PermanentRedirectError308
client-errors4xx
BadRequestError400
UnauthorizedError401
PaymentRequiredError402
ForbiddenError403
NotFoundError404
MethodNotAllowedError405
NotAcceptableError406
ProxyAuthenticationRequiredError407
RequestTimeoutError408
ConflictError409
GoneError410
LengthRequiredError411
PreconditionFailedError412
RequestTooLargeError413
URLTooLongError414
UnsupportedMediaTypeError415
RequestedRangeNotSatisfiableError416
ExpectationFailedError417
ImATeapotError418
PolicyNotFulfilledError420
MisdirectredRequestError421
UnprocessableEntityError422
LockedError423
FailedDependencyError424
UpgradeRequiredError426
PreconditionRequiredError428
TooManyRequestsError429
RequestHeaderTooLargeError431
UnavaliableForLegalReasonsError451
server-errors5xx
InternalServerError500
NotImplementedError501
BadGatewayError502
ServiceUnavaliableError503
GatewayTimeoutError504
VersionNotSupportedError505
InsufficientStorageError507
LoopDetectedError508
BandwithLimitExceededError509
NetworkAuthenticationRequiredError511