Created
February 20, 2015 14:03
-
-
Save naholyr/7541bdd12817578eee74 to your computer and use it in GitHub Desktop.
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
// foo() fait une opération compliquée | |
// mais c'est codé un peu avec les pieds et un des EventEmitter déclaré (et non exposé) | |
// dans la fonction émet parfois un "error" non catché qui pète mon application :( | |
var foo = require("./module-pourri"); | |
// Ça fait parfois péter mon app :( | |
//foo(); | |
// Magie, j'ai juste à l'isoler dans un domaine :D | |
var d = require("domain").create(); | |
d.on("error", console.error); | |
var bar = d.bind(foo); | |
bar(); |
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
"use strict"; | |
module.exports = function foo () { | |
(new (require("events").EventEmitter)).emit("error", new Error("catch me if you can")); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment