diff --git a/lib/shared/components/errors/GenericError.tsx b/lib/shared/components/errors/GenericError.tsx index 6072ac94c..ae0b2270f 100644 --- a/lib/shared/components/errors/GenericError.tsx +++ b/lib/shared/components/errors/GenericError.tsx @@ -3,6 +3,7 @@ import { AlertProps, Text } from '@chakra-ui/react' import { ErrorAlert } from './ErrorAlert' import { + isNotEnoughGasError, isPausedError, isTooManyRequestsError, isUserRejectedError, @@ -55,6 +56,17 @@ export function GenericError({ error: _error, customErrorName, ...rest }: Props) ) } + if (isNotEnoughGasError(_error)) { + return ( + + + It looks like you don't have enough gas for this transaction. You can report the + problem in our discord if + the issue persists. + + + ) + } const errorMessage = error?.shortMessage || error.message if (errorMessage === 'RPC Request failed.' || errorMessage === 'An unknown RPC error occurred.') { diff --git a/lib/shared/utils/error-filters.ts b/lib/shared/utils/error-filters.ts index 6811ff2c1..efa7228ae 100644 --- a/lib/shared/utils/error-filters.ts +++ b/lib/shared/utils/error-filters.ts @@ -26,6 +26,11 @@ export function isTooManyRequestsError(error?: Error | null): boolean { return error.message.startsWith('HTTP request failed.') && error.message.includes('Status: 429') } +export function isNotEnoughGasError(error?: Error | null): boolean { + if (!error) return false + return error.message.startsWith('Execution reverted with reason: TRANSFER_FROM_FAILED.') +} + export function isPausedError(error?: Error | null): boolean { if (!error) return false return isPausedErrorMessage(error.message)