Created
October 16, 2013 12:20
-
-
Save janpieper/7006836 to your computer and use it in GitHub Desktop.
Can't catch thrown Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require("util") | |
, fs = require("fs"); | |
exports.create = function () { | |
var b = new Bar(); | |
b.bla(); | |
}; | |
var Bar = function () {}; | |
Bar.prototype.bla = function () { | |
fs.open("./text", "r", function (err, fd) { | |
if (err) { | |
throw new Error(util.format("hahahahaha: %s", "blaaaa")); | |
} | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bar = require("./bar"); | |
try { | |
Bar.create("...", function () {}); | |
} catch (e) { | |
console.log("CAUGHT EXCEPTION"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment