Skip to content

Commit

Permalink
fix: catch for eth_call metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Sep 18, 2024
1 parent 75bd625 commit ffed485
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions utilsApi/nextApiWrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,20 @@ const collectRequestAddressMetric = async ({
const address = utils.getAddress(to) as `0x${string}`;
const contractName = METRIC_CONTRACT_ADDRESSES[chainId]?.[address];
const methodEncoded = data?.slice(0, 10); // `0x` and 8 next symbols
const methodDecoded = contractName
? getMetricContractInterface(contractName)?.getFunction(methodEncoded)
?.name
: null;

let methodDecoded = 'N/A';
try {
if (contractName) {
methodDecoded =
getMetricContractInterface(contractName).getFunction(
methodEncoded,
).name;
}
} catch (error) {
console.warn(
`[collectRequestAddressMetric] failed to decode ${methodEncoded} method for ${contractName}: ${error} `,
);
}

metrics
.labels({
Expand Down

0 comments on commit ffed485

Please sign in to comment.