aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/utils
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-09 03:38:37 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commit410a9244952b663fa8e56cc778b712ae228bbd82 (patch)
treeef9951abc2c867596c23bce159aca6f3536efe65 /packages/pipeline/src/utils
parent53cc9e9bedc6adf2247a190dbb758c9411033cab (diff)
downloaddexon-sol-tools-410a9244952b663fa8e56cc778b712ae228bbd82.tar.gz
dexon-sol-tools-410a9244952b663fa8e56cc778b712ae228bbd82.tar.zst
dexon-sol-tools-410a9244952b663fa8e56cc778b712ae228bbd82.zip
Add better error handling for immediately invoked async functions
Diffstat (limited to 'packages/pipeline/src/utils')
-rw-r--r--packages/pipeline/src/utils/index.ts14
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);
+}