Skip to content

Instantly share code, notes, and snippets.

@pguillory
Created January 26, 2011 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pguillory/797354 to your computer and use it in GitHub Desktop.
Save pguillory/797354 to your computer and use it in GitHub Desktop.
f1(function(err) {
console.log(err);
});
function f1(callback) {
// throw new Error("You can catch me.");
f2(function(err) {
if (err) return callback(err);
f3(function(err) {
if (err) return callback(err);
return callback(null);
})
})
}
function f2(callback) {
// return callback(new Error("I'll propagate through the callback."))
return callback(null);
}
function f3(callback) {
throw new Error("I'm the gingerbread man and I'll crash your program.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment