diff options
Diffstat (limited to 'packages/testnet-faucets/src/ts/error_reporter.ts')
-rw-r--r-- | packages/testnet-faucets/src/ts/error_reporter.ts | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/packages/testnet-faucets/src/ts/error_reporter.ts b/packages/testnet-faucets/src/ts/error_reporter.ts deleted file mode 100644 index d5358aed0..000000000 --- a/packages/testnet-faucets/src/ts/error_reporter.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { logUtils } from '@0x/utils'; -import * as express from 'express'; -import rollbar = require('rollbar'); - -import { configs } from './configs'; - -export const errorReporter = { - setup(): void { - rollbar.init(configs.ROLLBAR_ACCESS_KEY, { - environment: configs.ENVIRONMENT, - }); - rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY); - process.on('unhandledRejection', async (err: Error) => { - logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`); - await errorReporter.reportAsync(err); - process.exit(1); - }); - }, - async reportAsync(err: Error, req?: express.Request): Promise<any> { - if (configs.ENVIRONMENT === 'development') { - return; // Do not log development environment errors - } - return new Promise<any>((resolve, reject) => { - rollbar.handleError(err, req, (rollbarErr: Error) => { - if (rollbarErr) { - logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`); - reject(rollbarErr); - } else { - resolve(); - } - }); - }); - }, - errorHandler(): any { - return rollbar.errorHandler(configs.ROLLBAR_ACCESS_KEY); - }, -}; |