aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-18 05:02:39 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-18 05:44:40 +0800
commitae4f1a093a3d02f13e56716dca2383a42b6422ba (patch)
treea5898270e84daa188630c6e7c5cf22e590bdac22 /packages/instant/src/util
parent2b495a793521397ed4e81764aa87c3a51fef0a72 (diff)
downloaddexon-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.ts13
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;
};