handle other errors
This commit is contained in:
parent
2b495a7935
commit
ae4f1a093a
@ -28,11 +28,22 @@ class ErrorFlasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const humanReadableMessageForError = (error: Error, assetData?: string): string | undefined => {
|
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');
|
const assetName = assetDataUtil.bestNameForAsset(assetData, 'of this asset');
|
||||||
return `Not enough ${assetName} available`;
|
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;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user