From ea168eb44b65b6b9e15053cc42c4c97da93adfa2 Mon Sep 17 00:00:00 2001 From: David Banham Date: Wed, 15 Mar 2017 11:49:32 +1100 Subject: [PATCH] Remove catch statement for event handlers 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. --- lib/application.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/application.js b/lib/application.js index 3b4c5249..25a3adfd 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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); } } }