diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-09 03:38:37 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-06 19:04:25 +0800 |
commit | c21cf55b862bd6744d0a950f289dce350b32fe02 (patch) | |
tree | 6455637298186847d06f695b28e189d5cacaec43 /packages/pipeline/src/utils/index.ts | |
parent | 2dfdc19c9ed56785d679af47fec92c133c5a2e3a (diff) | |
download | dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar.gz dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar.bz2 dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar.lz dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar.xz dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.tar.zst dexon-sol-tools-c21cf55b862bd6744d0a950f289dce350b32fe02.zip |
Add better error handling for immediately invoked async functions
Diffstat (limited to 'packages/pipeline/src/utils/index.ts')
-rw-r--r-- | packages/pipeline/src/utils/index.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/pipeline/src/utils/index.ts b/packages/pipeline/src/utils/index.ts index ebc1f8e0f..4242e0437 100644 --- a/packages/pipeline/src/utils/index.ts +++ b/packages/pipeline/src/utils/index.ts @@ -6,3 +6,17 @@ export function bigNumbertoStringOrNull(n: BigNumber): string | null { } return n.toString(); } + +export function handleError(e: any): void { + if (e.message != null) { + console.error(e.message); + } else { + console.error('Unknown error'); + } + if (e.stack != null) { + console.error(e.stack); + } else { + console.error('(No stack trace)'); + } + process.exit(1); +} |