Add AssetUnavailable error

This commit is contained in:
Brandon Millman
2018-10-02 15:44:11 -07:00
parent b3a868da0e
commit 75d6970e6c
2 changed files with 4 additions and 7 deletions

View File

@@ -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,

View File

@@ -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 {