Closed Raynos closed 11 years ago
I tried fixing the reproduction code to do domains "properly"
setTimeout(function () {
var EventEmitter = require("events").EventEmitter
var firstEmitter = new EventEmitter()
process.nextTick(function () {
var emitter = new EventEmitter()
var correctDomain = emitter.domain
emitter.once("error", function (err) {
process.nextTick(function () {
var oldDomain = firstEmitter.domain
correctDomain.add(firstEmitter)
firstEmitter.emit("error", err)
oldDomain.add(firstEmitter)
})
})
emitter.emit("error", { foo: 42 })
})
}, 100)
Putting the firstEmitter
in the "correct" domain does not seem to help.
Now that I think about it for a moment I'm not actually sure why the re emit on different event emitter case breaks. This might be a bug in trycatch
I'm using trycatch with mongodb. It is not printing long stack traces and only showing a single stack
mongodb re emits errors from one emitter onto another emitter ( https://github.com/mongodb/node-mongodb-native/blob/master/lib/mongodb/connection/base.js#L216 )
I believe it loses the right domain.
Here is a mongodb example that doesnt work with long stack traces
This prints
This is a reproduction of the issue without the mongodb specifics
Here is the stack trace (not long)
Is this an issue with trycatch or with mongodb ?