From cbb1645369761326d86588d8a947af85342eecf0 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 30 Jun 2015 18:16:08 -0300 Subject: [PATCH] try catch on formatAmount --- lib/emailservice.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/emailservice.js b/lib/emailservice.js index a0b9387..f3cfd7e 100644 --- a/lib/emailservice.js +++ b/lib/emailservice.js @@ -193,7 +193,11 @@ EmailService.prototype._getDataForTemplate = function(notification, recipient, c var data = _.cloneDeep(notification.data); data.subjectPrefix = _.trim(self.subjectPrefix) + ' '; if (data.amount) { - data.amount = WalletUtils.formatAmount(+data.amount, recipient.unit) + ' ' + recipient.unit; + try { + data.amount = WalletUtils.formatAmount(+data.amount, recipient.unit) + ' ' + recipient.unit; + } catch (ex) { + return cb(new Error('Could not format amount', ex)); + } } self.storage.fetchWallet(notification.walletId, function(err, wallet) { if (err) return cb(err); diff --git a/package.json b/package.json index e9dd0bf..77f8221 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "bitcore-wallet-service", "description": "A service for Mutisig HD Bitcoin Wallets", "author": "BitPay Inc", - "version": "0.0.39", + "version": "0.0.40", "keywords": [ "bitcoin", "copay",