Skip to content

Instantly share code, notes, and snippets.

@janpieper
Created October 16, 2013 12:20
Show Gist options
  • Save janpieper/7006836 to your computer and use it in GitHub Desktop.
Save janpieper/7006836 to your computer and use it in GitHub Desktop.
Can't catch thrown Error
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"));
}
});
};
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