aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-03 06:44:11 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-03 06:44:11 +0800
commit75d6970e6c9bdeb6004228084bb541994b18e8c3 (patch)
tree2071cc854ca3e74a16e10e040ff911a40d64ed2a /packages/asset-buyer
parentb3a868da0e77da04b123f4ff397d8f1a3a4d3810 (diff)
downloaddexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.gz
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.bz2
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.lz
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.xz
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.tar.zst
dexon-sol-tools-75d6970e6c9bdeb6004228084bb541994b18e8c3.zip
Add AssetUnavailable error
Diffstat (limited to 'packages/asset-buyer')
-rw-r--r--packages/asset-buyer/src/asset_buyer.ts3
-rw-r--r--packages/asset-buyer/src/types.ts8
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 {