Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-http-errors

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-http-errors

Easy HTTP errors

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Easy Http Errors

npm node Build Status Coverage Status

A preset of HTTP errors that can be easily used to throw errors in your applications.

Installation

NPM

npm i easy-http-errors --save

Yarn

yarn add easy-http-errors

Usage

// ES6 import.
import { BadRequestError } from 'easy-http-errors';

// Throw the default bad request.
throw new BadRequestError();

// Throw a bad request with a custom message and properties.
throw new BadRequestError('Ups, this is a bad request', { foo: 'bar' });

List of errors

Status CodeName
400BadRequestError
401UnauthorizedError
402PaymentRequiredError
403ForbiddenError
404NotFoundError
405MethodNotAllowedError
406NotAcceptableError
407ProxyAuthenticationRequiredError
408RequestTimeoutError
409ConflictError
410GoneError
411LengthRequiredError
412PreconditionFailedError
413PayloadTooLargeError
414URITooLongError
415UnsupportedMediaTypeError
416RangeNotSatisfiableError
417ExpectationFailedError
418ImATeapotError
421MisdirectedRequestError
422UnprocessableEntityError
423LockedError
424FailedDependencyError
425UnorderedCollectionError
426UpgradeRequiredError
428PreconditionRequiredError
429TooManyRequestsError
431RequestHeaderFieldsTooLargeError
451UnavailableForLegalReasonsError
500InternalServerError
501NotImplementedError
502BadGatewayError
503ServiceUnavailableError
504GatewayTimeoutError
505HTTPVersionNotSupportedError
506VariantAlsoNegotiatesError
507InsufficientStorageError
508LoopDetectedError
509BandwidthLimitExceededError
510NotExtendedError
511NetworkAuthenticationRequiredError

Tests

Run the tests from the root directory:

npm test

Contributing & Development

Contributing

Found a bug or want to suggest something? Take a look first on the current and closed issues. If it is something new, please submit an issue.

Develop

It will be awesome if you can help us evolve easy-http-errors. Want to help?

  1. Fork it.
  2. npm install.
  3. Hack away.
  4. Run the tests: npm test.
  5. Create a Pull Request.

Keywords

FAQs

Package last updated on 19 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc