aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/utils/index.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-13 09:36:33 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commit688d277b30b287f66f0dbd49f2a23cab8b256219 (patch)
tree97519ff71a2cd9e62c185f04556cd7b4cb6b62d8 /packages/pipeline/src/utils/index.ts
parent329c68f610843ebded9ca31fc9cd6f3eed744a8e (diff)
downloaddexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.gz
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.bz2
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.lz
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.xz
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.tar.zst
dexon-sol-tools-688d277b30b287f66f0dbd49f2a23cab8b256219.zip
Configure linter with --format stylish and fix linter errors
Diffstat (limited to 'packages/pipeline/src/utils/index.ts')
-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 4242e0437..a083cd8c9 100644
--- a/packages/pipeline/src/utils/index.ts
+++ b/packages/pipeline/src/utils/index.ts
@@ -1,5 +1,10 @@
import { BigNumber } from '@0x/utils';
+/**
+ * If the given BigNumber is not null, returns the string representation of that
+ * number. Otherwise, returns null.
+ * @param n The number to convert.
+ */
export function bigNumbertoStringOrNull(n: BigNumber): string | null {
if (n == null) {
return null;
@@ -7,15 +12,24 @@ export function bigNumbertoStringOrNull(n: BigNumber): string | null {
return n.toString();
}
+/**
+ * Logs an error by intelligently checking for `message` and `stack` properties.
+ * Intended for use with top-level immediately invoked asynchronous functions.
+ * @param e the error to log.
+ */
export function handleError(e: any): void {
if (e.message != null) {
+ // tslint:disable-next-line:no-console
console.error(e.message);
} else {
+ // tslint:disable-next-line:no-console
console.error('Unknown error');
}
if (e.stack != null) {
+ // tslint:disable-next-line:no-console
console.error(e.stack);
} else {
+ // tslint:disable-next-line:no-console
console.error('(No stack trace)');
}
process.exit(1);