rhettl / if-err

DRY: if(err) throw err;

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ifErr

get rid of if (err) throw err

install

npm install if-err

usage

var error = require('if-err');

asyncFunc(function (err) {
  error.if(err);
});

asyncFunc(function (err) {
  error.if(err, 'bad things happened');
});

asyncFunc(function (err, data) {
  error.if(err, 'bad things happened');
  error.ifNot(data, 'data wasn\'t returned');
});

Contributors

About

DRY: if(err) throw err;


Languages

Language:JavaScript 100.0%