Giter Club home page Giter Club logo

http-errors-response's Introduction

HTTP errors response

npm (scoped) contributions welcome tests

This library provide some Error classes to map the problems that you may want to report to your clients.

Usage

npm install http-errors-response-ts --save

Usage

import error from lib
import { BadRequestResponse } from 'http-errors-response-ts';

throw new BadRequestResponse();

expexted object

{
  "statusCode": 400,
  "message": "Bad Request"
}
with custom message
import { BadRequestResponse } from 'http-errors-response-ts';

throw new BadRequestResponse('Custom message');

expexted object

{
  "statusCode": 400,
  "message": "Custom message"
}

List of all Error

Status Code Error Name
400 BadRequestResponse
401 UnauthorizedResponse
402 PaymentRequiredResponse
403 ForbiddenResponse
404 NotFoundResponse
405 MethodNotAllowedResponse
406 NotAcceptableResponse
407 ProxyAuthenticationRequiredResponse
408 RequestTimeoutResponse
409 ConflictResponse
410 GoneResponse
411 LengthRequiredResponse
412 PreconditionFailedResponse
413 PayloadTooLargeResponse
414 URITooLongResponse
415 UnsupportedMediaTypeResponse
416 RangeNotSatisfiableResponse
417 ExpectationFailedResponse
418 ImATeapotResponse
421 MisdirectedRequestResponse
422 UnprocessableEntityResponse
423 LockedResponse
424 FailedDependencyResponse
425 UnorderedCollectionResponse
426 UpgradeRequiredResponse
428 PreconditionRequiredResponse
429 TooManyRequestsResponse
431 RequestHeaderFieldsTooLargeResponse
451 UnavailableForLegalReasonsResponse
500 InternalServerErrorResponse
501 NotImplementedResponse
502 BadGatewayResponse
503 ServiceUnavailableResponse
504 GatewayTimeoutResponse
505 HTTPVersionNotSupportedResponse
506 VariantAlsoNegotiatesResponse
507 InsufficientStorageResponse
508 LoopDetectedResponse
509 BandwidthLimitExceededResponse
510 NotExtendedResponse
511 NetworkAuthenticationRequiredResponse

http-errors-response's People

Contributors

dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.