diff options
Diffstat (limited to 'packages/asset-buyer/src')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 3 | ||||
-rw-r--r-- | packages/asset-buyer/src/types.ts | 8 |
2 files changed, 4 insertions, 7 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, diff --git a/packages/asset-buyer/src/types.ts b/packages/asset-buyer/src/types.ts index 074bcd453..8d3dcbfe6 100644 --- a/packages/asset-buyer/src/types.ts +++ b/packages/asset-buyer/src/types.ts @@ -96,13 +96,7 @@ export enum AssetBuyerError { InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY', NoAddressAvailable = 'NO_ADDRESS_AVAILABLE', InvalidOrderProviderResponse = 'INVALID_ORDER_PROVIDER_RESPONSE', -} - -/** - * Possible errors thrown by an AssetBuyerManager instance or associated static methods. - */ -export enum AssetBuyerManagerError { - AssetBuyerNotFound = 'ASSET_BUYER_NOT_FOUND', + AssetUnavailable = 'ASSET_UNAVAILABLE', } export interface OrdersAndFillableAmounts { |