checkerr
v0.1.0
Published
check for errors in callback functions in one line
Downloads
20
Readme
Checkerr
Check for callback errors and handle them in one line
Exit process on error
var check = require('checkerr').andExitProcess;
doSomething(function(err, result)) {
check(err);
doActualStuff(result);
});
Call a higher callback on error
var check = require('checkerr').andCallHigherCallback;
function mainFunction(topmostCallback) {
doSomething(function(err, result)) {
if(check(err, topmostCallback)) return;
doActualStuff(result);
});
});
To mock out, with mockery e.g.
mockery.registerSubstitute('checkerr', 'checkerr/mock-disable');