diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-07-13 06:50:13 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-07-13 06:56:01 +0800 |
commit | ac5588c7c436e2540f87e432446e103d35c9221a (patch) | |
tree | 75fb70ebf9cfb0aaa3450610f2072a43c3b2f1bc /packages/website/ts/utils/error_reporter.ts | |
parent | ddb70a89ad99527e03844d23e7c0f3522e98a602 (diff) | |
download | dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar.gz dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar.bz2 dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar.lz dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar.xz dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.tar.zst dexon-sol-tools-ac5588c7c436e2540f87e432446e103d35c9221a.zip |
Make error reporter not return a promise and add more environment possibilities
Diffstat (limited to 'packages/website/ts/utils/error_reporter.ts')
-rw-r--r-- | packages/website/ts/utils/error_reporter.ts | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/packages/website/ts/utils/error_reporter.ts b/packages/website/ts/utils/error_reporter.ts index 2d0661b25..d38269d92 100644 --- a/packages/website/ts/utils/error_reporter.ts +++ b/packages/website/ts/utils/error_reporter.ts @@ -2,6 +2,7 @@ import { logUtils } from '@0xproject/utils'; import { Environments } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; +import { utils } from 'ts/utils/utils'; // Suggested way to include Rollbar with Webpack // https://github.com/rollbar/rollbar.js/tree/master/examples/webpack @@ -12,7 +13,7 @@ const rollbarConfig = { itemsPerMinute: 10, maxItems: 500, payload: { - environment: configs.ENVIRONMENT, + environment: utils.getEnvironment(), client: { javascript: { source_map_enabled: true, @@ -40,21 +41,14 @@ import Rollbar = require('../../public/js/rollbar.umd.min.js'); const rollbar = Rollbar.init(rollbarConfig); export const errorReporter = { - async reportAsync(err: Error): Promise<any> { - if (configs.ENVIRONMENT === Environments.DEVELOPMENT) { + report(err: Error): void { + if (utils.getEnvironment() === Environments.DEVELOPMENT) { return; // Let's not log development errors to rollbar } - - return new Promise((resolve, _reject) => { - rollbar.error(err, (rollbarErr: Error) => { - if (rollbarErr) { - logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`); - // We never want to reject and cause the app to throw because of rollbar - resolve(); - } else { - resolve(); - } - }); + rollbar.error(err, (rollbarErr: Error) => { + if (rollbarErr) { + logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`); + } }); }, }; |