
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
easy-http-errors
Advanced tools
A preset of HTTP errors that can be easily used to throw errors in your applications.
npm i easy-http-errors --save
yarn add easy-http-errors
// 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' });
| Status Code | Name |
|---|---|
| 400 | BadRequestError |
| 401 | UnauthorizedError |
| 402 | PaymentRequiredError |
| 403 | ForbiddenError |
| 404 | NotFoundError |
| 405 | MethodNotAllowedError |
| 406 | NotAcceptableError |
| 407 | ProxyAuthenticationRequiredError |
| 408 | RequestTimeoutError |
| 409 | ConflictError |
| 410 | GoneError |
| 411 | LengthRequiredError |
| 412 | PreconditionFailedError |
| 413 | PayloadTooLargeError |
| 414 | URITooLongError |
| 415 | UnsupportedMediaTypeError |
| 416 | RangeNotSatisfiableError |
| 417 | ExpectationFailedError |
| 418 | ImATeapotError |
| 421 | MisdirectedRequestError |
| 422 | UnprocessableEntityError |
| 423 | LockedError |
| 424 | FailedDependencyError |
| 425 | UnorderedCollectionError |
| 426 | UpgradeRequiredError |
| 428 | PreconditionRequiredError |
| 429 | TooManyRequestsError |
| 431 | RequestHeaderFieldsTooLargeError |
| 451 | UnavailableForLegalReasonsError |
| 500 | InternalServerError |
| 501 | NotImplementedError |
| 502 | BadGatewayError |
| 503 | ServiceUnavailableError |
| 504 | GatewayTimeoutError |
| 505 | HTTPVersionNotSupportedError |
| 506 | VariantAlsoNegotiatesError |
| 507 | InsufficientStorageError |
| 508 | LoopDetectedError |
| 509 | BandwidthLimitExceededError |
| 510 | NotExtendedError |
| 511 | NetworkAuthenticationRequiredError |
Run the tests from the root directory:
npm test
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.
It will be awesome if you can help us evolve easy-http-errors. Want to help?
npm install.npm test.FAQs
Easy HTTP errors
We found that easy-http-errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.