From ae4f1a093a3d02f13e56716dca2383a42b6422ba Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Wed, 17 Oct 2018 14:02:39 -0700 Subject: handle other errors --- packages/instant/src/util/error.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'packages/instant/src') diff --git a/packages/instant/src/util/error.ts b/packages/instant/src/util/error.ts index 78d056e11..48cb131a9 100644 --- a/packages/instant/src/util/error.ts +++ b/packages/instant/src/util/error.ts @@ -28,11 +28,22 @@ class ErrorFlasher { } const humanReadableMessageForError = (error: Error, assetData?: string): string | undefined => { - if (error.message === AssetBuyerError.InsufficientAssetLiquidity) { + const hasInsufficientLiquidity = + error.message === AssetBuyerError.InsufficientAssetLiquidity || + error.message === AssetBuyerError.InsufficientZrxLiquidity; + if (hasInsufficientLiquidity) { const assetName = assetDataUtil.bestNameForAsset(assetData, 'of this asset'); return `Not enough ${assetName} available`; } + if ( + error.message === AssetBuyerError.StandardRelayerApiError || + error.message.startsWith(AssetBuyerError.AssetUnavailable) + ) { + const assetName = assetDataUtil.bestNameForAsset(assetData, 'This asset'); + return `${assetName} is currently unavailable`; + } + return undefined; }; -- cgit v1.2.3