diff options
Diffstat (limited to 'packages/asset-buyer/src/errors.ts')
-rw-r--r-- | packages/asset-buyer/src/errors.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/errors.ts b/packages/asset-buyer/src/errors.ts new file mode 100644 index 000000000..ef05a5d0a --- /dev/null +++ b/packages/asset-buyer/src/errors.ts @@ -0,0 +1,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); + } +} |