Skip to content

Commit

Permalink
fix: Prevent errors from occasionally being swallowed
Browse files Browse the repository at this point in the history
  • Loading branch information
symposion committed Apr 6, 2017
1 parent c2300ef commit 27edbb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/event-dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ module.exports = class EventDispatcher {
const self = this;
return function handlerWrapper() {
try {
handler.apply(null, arguments);
const retVal = handler.apply(null, arguments);
if (retVal instanceof Promise) {
retVal.catch(self.errorHandler);
}
}
catch (e) {
self.errorHandler(e);
Expand Down

0 comments on commit 27edbb0

Please sign in to comment.