Skip to content

bchociej/checkerr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');

About

handle optional errors in callbacks in one line

Resources

License

Stars

Watchers

Forks

Packages

No packages published