Skip to content

Commit

Permalink
Merge pull request #3680 from balancer/hf/skip-faucet-refill-error
Browse files Browse the repository at this point in the history
hotfix: skip faucet refill error
  • Loading branch information
alter-eggo authored Jul 12, 2023
2 parents 9678e96 + 566fda4 commit bff7e02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/composables/useTransactionErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export function isUserNotEnoughGas(error): boolean {
return isErrorType(error, messages);
}

export function isFaucetRefillError(error): boolean {
const messages = [/execution reverted: ERR_NEEDS_REFILL/];
return isErrorType(error, messages);
}

function isErrorType(error, messages: RegExp[]): boolean {
if (!error) return false;

Expand All @@ -45,7 +50,9 @@ function isErrorType(error, messages: RegExp[]): boolean {

if (
typeof error.reason === 'string' &&
messages.some(msg => msg.test(error.reason.toLowerCase()))
messages.some(
msg => msg.test(error.reason) || msg.test(error.reason.toLowerCase())
)
)
return true;

Expand Down
11 changes: 9 additions & 2 deletions src/services/web3/transactions/concerns/transaction.concern.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { isUserError } from '@/composables/useTransactionErrors';
import {
isFaucetRefillError,
isUserError,
} from '@/composables/useTransactionErrors';
import { configService } from '@/services/config/config.service';
import { gasService } from '@/services/gas/gas.service';
import { rpcProviderService } from '@/services/rpc-provider/rpc-provider.service';
Expand All @@ -11,6 +14,10 @@ export class TransactionConcern {
) {}

public shouldLogFailure(error): boolean {
return this.config.env.APP_ENV !== 'development' && !isUserError(error);
return (
this.config.env.APP_ENV !== 'development' &&
!isUserError(error) &&
!isFaucetRefillError(error)
);
}
}

0 comments on commit bff7e02

Please sign in to comment.