Skip to content

Commit

Permalink
Remove catch statement for event handlers
Browse files Browse the repository at this point in the history
I'm not sure we should be catching and discarding exceptions from external code. If a consumer of the library causes an exception in their handler, it's up to them to deal with it. The danger with leaving the catch in is that someone hits some fatal condition and they throw an exception in order to take down the application or be handled upstream. Having it eaten inside the Xero lib would be unexpected behaviour.
  • Loading branch information
davidbanham committed Mar 15, 2017
1 parent 12c5b81 commit ea168eb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/application.js
Expand Up @@ -600,11 +600,7 @@ var RequireAuthorizationApplication = Application.extend({
if (options.accessToken !== this.options.accessToken) {
if (this.eventEmitter) {
logger.debug("Emitting event");
try {
this.eventEmitter.emit('xeroTokenUpdate', options);
} catch (e) {
logger.error(e);
}
this.eventEmitter.emit('xeroTokenUpdate', options);
}
}
}
Expand Down

0 comments on commit ea168eb

Please sign in to comment.