@@ -15,6 +15,8 @@ export function swapErrorToUserReadableMessage(error: any): string {
...
@@ -15,6 +15,8 @@ export function swapErrorToUserReadableMessage(error: any): string {
}
}
}
}
console.warn('Swap error:',error)
while(error){
while(error){
reason=error.reason??error.message??reason
reason=error.reason??error.message??reason
error=error.error??error.data?.originalError
error=error.error??error.data?.originalError
...
@@ -44,8 +46,7 @@ export function swapErrorToUserReadableMessage(error: any): string {
...
@@ -44,8 +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){
returnt`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.`
returnt`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.`
}
}
returnt`Unknown error${
returnt`Unknown error${reason?`: "${reason}"`:''}. Try increasing your slippage tolerance.
reason?`: "${reason}"`:''
Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.`
}. Try increasing your slippage tolerance. Note: fee on transfer and rebase tokens are incompatible with Uniswap V3.`