Browse Source

Treat 'typeof Error' promise errors properly

Instead of JSON encoding them, just rethrow promise errors since that
produces much cleaner error messages.
v0.7.4-release
Felix Geisendörfer 15 years ago
committed by Ryan Dahl
parent
commit
b57d7d9b4e
  1. 4
      src/node.js

4
src/node.js

@ -294,7 +294,9 @@ var eventsModule = createInternalModule('events', function (exports) {
var self = this;
process.nextTick(function() {
if (self.listeners('error').length == 0) {
throw new Error('Unhandled emitError: '+JSON.stringify(self._values));
throw (self._values[0] instanceof Error)
? self._values[0]
: new Error('Unhandled emitError: '+JSON.stringify(self._values));
}
});
}

Loading…
Cancel
Save