diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-18 05:02:39 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-18 05:44:40 +0800 |
commit | ae4f1a093a3d02f13e56716dca2383a42b6422ba (patch) | |
tree | a5898270e84daa188630c6e7c5cf22e590bdac22 /packages/instant/src/util | |
parent | 2b495a793521397ed4e81764aa87c3a51fef0a72 (diff) | |
download | dexon-sol-tools-ae4f1a093a3d02f13e56716dca2383a42b6422ba.tar.gz dexon-sol-tools-ae4f1a093a3d02f13e56716dca2383a42b6422ba.tar.zst dexon-sol-tools-ae4f1a093a3d02f13e56716dca2383a42b6422ba.zip |
handle other errors
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/error.ts | 13 |
1 files changed, 12 insertions, 1 deletions
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; }; |