aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/errors.ts
blob: ef05a5d0a3bbbe9d7b587cdca7748ce4e79acd6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { BigNumber } from '@0x/utils';

import { AssetBuyerError } from './types';

/**
 * Error class representing insufficient asset liquidity
 */
export class InsufficientAssetLiquidityError extends Error {
    public amountAvailableToFill?: BigNumber;
    constructor(amountAvailableToFill?: BigNumber) {
        super(AssetBuyerError.InsufficientAssetLiquidity);
        this.amountAvailableToFill = amountAvailableToFill;
        // Setting prototype so instanceof works.  See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
        Object.setPrototypeOf(this, InsufficientAssetLiquidityError.prototype);
    }
}