Skip to content

Commit 622ad9f

Browse files
committed
fix: add error handling for log parsing in disputeRelayerBot script
1 parent 93b2600 commit 622ad9f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

contracts/scripts/disputeRelayerBot.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ export default async function main(
104104
const disputeRequests: DisputeRequestEvent.OutputObject[] =
105105
fullTxReceipt.logs
106106
.filter((log: Log) => log.topics[0] === disputeRequestTopic)
107-
.map(
108-
(log: Log) =>
109-
arbitrableInterface.parseLog(log)!
110-
.args as unknown as DisputeRequestEvent.OutputObject,
111-
);
107+
.map((log: Log) => {
108+
const parsed = arbitrableInterface.parseLog(log);
109+
if (!parsed) {
110+
throw new Error(
111+
`Failed to parse DisputeRequest log: ${log.transactionHash}`,
112+
);
113+
}
114+
return parsed.args as unknown as DisputeRequestEvent.OutputObject;
115+
});
112116
logger.warn(
113117
`More than 1 DisputeRequest event: not supported yet, skipping the others events.`,
114118
);

0 commit comments

Comments
 (0)