aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/utils/index.ts
blob: 4242e043782e588827982000a69f212dc7bc8e02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { BigNumber } from '@0x/utils';

export function bigNumbertoStringOrNull(n: BigNumber): string | null {
    if (n == null) {
        return 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);
}