Socket
Book a DemoInstallSign in
Socket

kwest-handle-error

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kwest-handle-error

Reject responses with bad statuscode

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

kwest-handle-error Build Status Dependency Status

Error handler middleware for kwest module. Rejects responses with bad statuscodes.

Installation

$ npm install --save kwest-handle-error

Use

without errorHandler

var request = require('kwest-base');

request('http://www.example.com/not-found')
  .then(function (res) {
    console.log(res.statusCode); // 404
  });

with errorHandler

var handleError = require('kwest-handle-error'),
    kwest       = require('kwest-base'),
    request     = kwest.wrap(handleError());

request('http://www.example.com/not-found')
  .catch(function (err) {
    console.log(err.message); // "404: Not found"
  });

Keywords

kwest

FAQs

Package last updated on 27 Sep 2014

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