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

http-verror

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-verror

A simple tool that provides `verror` functionality extended by usable HTTP error codes for Express.js

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

http-verror - VError adaptation for usage with Express.js

Build Status Test Coverage Dependency Status

Installation

npm install http-verror --save

Usage

http-verror instance inherits all properties of WError. In other words, http-verror is a WError but with statusCode property being equal to the HTTP status code of the error you created.

Example

var errors = require('http-verror');

var err = new errors.Forbidden();

console.log(err.statusCode); // 403
console.log(err.message); // You're not allowed to perform such action

var err2 = new errors.InternalError(new Error('Some preceding error with internal data'), 'Brief error desc');

console.log(err2.statusCode); // 500
console.log(err2.message); // Brief error desc
console.log(err2.cause().message); // Some preceding error with internal data
console.log(err2.toString()); // HttpError: Brief error desc; caused by Error: Some preceding error with internal data

Errors

Status codeName
400BadRequest
401Unauthorized
402PaymentRequired
403Forbidden
404NotFound
405MethodNotAllowed
406NotAcceptable
408RequestTimeout
409Conflict
412PreconditionFailed
415UnsupportedMediaType
500InternalError
501NotImplemented
502BadGateway
503ServiceUnavailable
504GatewayTimeout

Keywords

FAQs

Package last updated on 17 May 2015

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