diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-13 09:36:33 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-06 19:04:25 +0800 |
commit | b818a62d745b2e91a8808ded9bac279d2dbf8a7e (patch) | |
tree | da2a095d1ee14ea7e1226de8911a5c323229be07 /packages/pipeline/src/utils/index.ts | |
parent | e69cdfb7b5b0b4c7517d5439d45888702c6a1b71 (diff) | |
download | dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar.gz dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar.bz2 dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar.lz dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar.xz dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.tar.zst dexon-sol-tools-b818a62d745b2e91a8808ded9bac279d2dbf8a7e.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.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 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); |