diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-10-03 06:44:11 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-10-03 06:44:11 +0800 |
commit | 75d6970e6c9bdeb6004228084bb541994b18e8c3 (patch) | |
tree | 2071cc854ca3e74a16e10e040ff911a40d64ed2a /packages/asset-buyer/src/asset_buyer.ts | |
parent | b3a868da0e77da04b123f4ff397d8f1a3a4d3810 (diff) | |
download | dexon-0x-contracts-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.gz dexon-0x-contracts-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.zst dexon-0x-contracts-75d6970e6c9bdeb6004228084bb541994b18e8c3.zip |
Add AssetUnavailable error
Diffstat (limited to 'packages/asset-buyer/src/asset_buyer.ts')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 990369615..587e4e941 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -160,6 +160,9 @@ export class AssetBuyer { this._getOrdersAndFillableAmountsAsync(zrxTokenAssetData, shouldForceOrderRefresh), shouldForceOrderRefresh, ]); + if (ordersAndFillableAmounts.orders.length === 0) { + throw new Error(`${AssetBuyerError.AssetUnavailable}: For assetData ${assetData}`); + } const buyQuote = buyQuoteCalculator.calculate( ordersAndFillableAmounts, feeOrdersAndFillableAmounts, |