request-callback-wrapper

2.0.0 • Public • Published

request-callback-wrapper

Wraps a callback for request to handle errors, status codes and ECONNREFUSED in a nicer way

Usage

var wrapCallback = require('request-callback-wrapper'),
    request = require('request');

request('/users', wrapCallback(function(error, users){
        if(error){
            return console.log(error);
        }

        console.log(users);
    })
);

Package Sidebar

Install

npm i request-callback-wrapper

Weekly Downloads

2,930

Version

2.0.0

License

MIT

Last publish

Collaborators

  • mauricebutler