
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
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
.v2.0.0 (2019-03-19)
Merged pull requests:
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.