Skip to content

Commit

Permalink
Better error coalescing for OpenEthereum nodes (#2846).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 29, 2022
1 parent a72e404 commit bebd669
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/providers/src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,28 @@ function checkError(method: string, error: any, params: any): any {
const transaction = params.transaction || params.signedTransaction;

// "insufficient funds for gas * price + value + cost(data)"
if (message.match(/insufficient funds|base fee exceeds gas limit/)) {
if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {
logger.throwError("insufficient funds for intrinsic transaction cost", Logger.errors.INSUFFICIENT_FUNDS, {
error, method, transaction
});
}

// "nonce too low"
if (message.match(/nonce (is )?too low/)) {
if (message.match(/nonce (is )?too low/i)) {
logger.throwError("nonce has already been used", Logger.errors.NONCE_EXPIRED, {
error, method, transaction
});
}

// "replacement transaction underpriced"
if (message.match(/replacement transaction underpriced/)) {
if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) {
logger.throwError("replacement fee too low", Logger.errors.REPLACEMENT_UNDERPRICED, {
error, method, transaction
});
}

// "replacement transaction underpriced"
if (message.match(/only replay-protected/)) {
if (message.match(/only replay-protected/i)) {
logger.throwError("legacy pre-eip-155 transactions not supported", Logger.errors.UNSUPPORTED_OPERATION, {
error, method, transaction
});
Expand Down

0 comments on commit bebd669

Please sign in to comment.