Commit a1f6c727 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: amend gas estimate error message (#5868)

* fix: amend gas estimate error message

* fix: language

* Update src/utils/swapErrorToUserReadableMessage.tsx
Co-authored-by: default avatarTina <59578595+tinaszheng@users.noreply.github.com>
Co-authored-by: default avatarTina <59578595+tinaszheng@users.noreply.github.com>
parent 8471d9b4
...@@ -57,7 +57,7 @@ export function useUniversalRouterSwapCallback( ...@@ -57,7 +57,7 @@ export function useUniversalRouterSwapCallback(
gasEstimate = await provider.estimateGas(tx) gasEstimate = await provider.estimateGas(tx)
} catch (gasError) { } catch (gasError) {
console.warn(gasError) console.warn(gasError)
throw new InvalidSwapError('Gas estimation failed. Wait a few minutes and try again.') throw new Error('Your swap is expected to fail')
} }
const gasLimit = calculateGasMargin(gasEstimate) const gasLimit = calculateGasMargin(gasEstimate)
const response = await provider const response = await provider
......
...@@ -46,7 +46,7 @@ export function swapErrorToUserReadableMessage(error: any): string { ...@@ -46,7 +46,7 @@ export function swapErrorToUserReadableMessage(error: any): string {
if (reason?.indexOf('undefined is not an object') !== -1) { if (reason?.indexOf('undefined is not an object') !== -1) {
return t`An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.` return t`An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.`
} }
return t`Unknown error${reason ? `: "${reason}"` : ''}. Try increasing your slippage tolerance. return t`${reason ? reason : 'Unknown error'}. Try increasing your slippage tolerance.
Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.` Note: fee-on-transfer and rebase tokens are incompatible with Uniswap V3.`
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment