aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-12 09:55:02 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-13 06:54:45 +0800
commitddb70a89ad99527e03844d23e7c0f3522e98a602 (patch)
treeff66f399103850776e7c8e0a93b61b8b2af2e712 /packages/website
parentf4b2a9625dd46080a4fd05754c525f73e5fff8b1 (diff)
downloaddexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar.gz
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar.bz2
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar.lz
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar.xz
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.tar.zst
dexon-sol-tools-ddb70a89ad99527e03844d23e7c0f3522e98a602.zip
Do not crash on NaN, and provide default
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/ts/utils/utils.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index e515cdeb3..1d669d8f0 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -28,8 +28,8 @@ import {
} from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
+import { errorReporter } from 'ts/utils/error_reporter';
import * as u2f from 'ts/vendor/u2f_api';
-import { errorReporter } from './error_reporter';
const isDogfood = (): boolean => _.includes(window.location.href, configs.DOMAIN_DOGFOOD);
@@ -391,7 +391,11 @@ export const utils = {
const format = `0,0.${_.repeat('0', precision)}`;
const formattedAmount = numeral(unitAmount).format(format);
if (_.isNaN(formattedAmount)) {
- throw new Error(`amount ${BigNumber}, decimals ${decimals} could not be formatted and returned NaN.`);
+ // tslint:disable-next-line:no-floating-promises
+ errorReporter.reportAsync(
+ new Error(`amount ${BigNumber}, decimals ${decimals} could not be formatted and returned NaN.`),
+ );
+ return format;
}
return formattedAmount;
},