Skip to content

Commit 1f4b5f8

Browse files
feat: better handle errors
Co-Authored-By: Lisandro Corbalan <lmcorbalan@gmail.com>
1 parent ccf1cd0 commit 1f4b5f8

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

typescript/solver/NonceKeeperWallet.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { BigNumber } from "@ethersproject/bignumber";
12
import { defaultPath, HDNode } from "@ethersproject/hdnode";
23
import type { Deferrable } from "@ethersproject/properties";
34
import type {
@@ -48,6 +49,14 @@ export class NonceKeeperWallet extends Wallet {
4849
return super.sendTransaction(transaction);
4950
}
5051

52+
async estimateGas(
53+
transaction: Deferrable<TransactionRequest>,
54+
): Promise<BigNumber> {
55+
return super
56+
.estimateGas(transaction)
57+
.catch((error) => checkError(error, { transaction }));
58+
}
59+
5160
static override fromMnemonic(
5261
mnemonic: string,
5362
path?: string,

typescript/solver/solvers/BaseFiller.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { BigNumber } from "@ethersproject/bignumber";
12
import type { MultiProvider } from "@hyperlane-xyz/sdk";
23
import type { Result } from "@hyperlane-xyz/utils";
34
import {
@@ -82,11 +83,19 @@ export abstract class BaseFiller<
8283
await this.fill(parsedArgs, data, originChainName, blockNumber);
8384

8485
await this.settleOrder(parsedArgs, data, originChainName);
85-
} catch (error) {
86+
} catch (error: any) {
8687
this.log.error({
8788
msg: `Failed processing intent`,
8889
intent: `${this.metadata.protocolName}-${parsedArgs.orderId}`,
89-
error: JSON.stringify(error),
90+
error: {
91+
stack: error.stack,
92+
details: JSON.stringify(error, (_, value) => {
93+
if (value instanceof BigNumber || typeof value === "bigint") {
94+
return value.toString();
95+
}
96+
return value;
97+
}),
98+
},
9099
});
91100
}
92101
};

0 commit comments

Comments
 (0)