New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@comodinx/http-errors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comodinx/http-errors

@comodinx/http-errors is a Node.js http errors classes.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

Http Errors

@comodinx/http-errors is a Node.js http errors classes.

Index

  • Download & Install.
  • How is it used?.
  • Available errors.
  • Tests.

Download & Install

NPM

$ npm install @comodinx/http-error

Source code

$ git clone https://gitlab.com/comodinx/http-error.git
$ cd http-error
$ npm install

How is it used?

'use strict';

const errors = require('@comodinx/http-error');
// ...
throw new errors.NotFound();
// All HTTP Status Code are an Exception
const e = new errors.NotFound('My custom message', { hello: 'world' });
// ...
console.log(e.toJson());
// { "error": 'My custom message', "code": 404, "extra": { "hello": "world" } }

Available errors

  • Continue
  • SwitchingProtocols
  • Processing
  • Ok
  • Created
  • Accepted
  • NonAuthoritativeInformation
  • NoContent
  • ResetContent
  • PartialContent
  • MultiStatus
  • AlreadyReported
  • ImUsed
  • MultipleChoices
  • MovedPermanently
  • Found
  • SeeOther
  • NotModified
  • UseProxy
  • SwitchProxy
  • TemporaryRedirect
  • PermanentRedirect
  • ResumeIncomplete
  • BadRequest
  • Unauthorized
  • PaymentRequired
  • Forbidden
  • NotFound
  • MethodNotAllowed
  • NotAcceptable
  • ProxyAuthenticationRequired
  • RequestTimeout
  • Conflict
  • Gone
  • LengthRequired
  • PreconditionFailed
  • PayloadTooLarge
  • UriTooLong
  • UnsupportedMediaType
  • RangeNotSatisfiable
  • ExpectationFailed
  • ImATeapot
  • AuthenticationTimeout
  • MethodFailure
  • EnhanceYourCalm
  • MisdirectedRequest
  • UnprocessableEntity
  • Locked
  • FailedDependency
  • UpgradeRequired
  • PreconditionRequired
  • TooManyRequests
  • RequestHeaderFieldsTooLarge
  • LoginTimeout
  • NoResponse
  • RetryWith
  • BlockedByWindowsParentalControls
  • UnavailableForLegalReasons
  • Redirect
  • RequestHeaderTooLarge
  • CertError
  • NoCert
  • HttpToHttps
  • TokenExpiredInvalid
  • ClientClosedRequest
  • TokenRequired
  • InternalServerError
  • NotImplemented
  • BadGateway
  • ServiceUnavailable
  • GatewayTimeout
  • HttpVersionNotSupported
  • VariantAlsoNegotiates
  • InsufficientStorage
  • LoopDetected
  • BandwidthLimitExceeded
  • NotExtended
  • NetworkAuthenticationRequired
  • UnknownError
  • OriginConnectionTimeout
  • NetworkReadTimeout
  • NetworkConnectTimeoutError
  • JsonErrorResponse
  • CustomError

Tests

In order to see more concrete examples, I INVITE YOU TO LOOK AT THE TESTS :)

Run the unit tests

npm test

Run an application (server) with a more formal example.

npm run test-app

Keywords

error

FAQs

Package last updated on 06 Apr 2021

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