Skip to content

Commit

Permalink
🥅 server: set level to sentry exceptions and remove unnecessary one
Browse files Browse the repository at this point in the history
  • Loading branch information
nfmelendez committed Nov 6, 2024
1 parent 24ef6a1 commit ec1644f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions server/hooks/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,18 @@ export default app.post(
const hash = await startSpan({ name: "deploy account", op: "tx.send" }, () =>
keeper.writeContract(request),
);
setContext("tx", { transactionHash: hash });
setContext("tx", { ...request, transactionHash: hash });
const receipt = await startSpan({ name: "tx.wait", op: "tx.wait" }, () =>
publicClient.waitForTransactionReceipt({ hash }),
);
setContext("tx", { ...request, ...receipt });
return receipt.status === "success";
} catch (error: unknown) {
captureException(error);
captureException(error, { level: "error" });
return false;
}
}))
) {
captureException(new Error("account deployment reverted"));
return;
}
await Promise.allSettled(
Expand Down Expand Up @@ -182,7 +180,8 @@ export default app.post(
publicClient.waitForTransactionReceipt({ hash }),
);
setContext("tx", { ...request, ...receipt });
if (receipt.status !== "success") captureException(new Error("tx reverted"));
if (receipt.status !== "success")
captureException(new Error("tx reverted"), { level: "error" });
} catch (error: unknown) {
if (
error instanceof BaseError &&
Expand All @@ -191,7 +190,7 @@ export default app.post(
) {
return;
}
captureException(error);
captureException(error, { level: "error" });
}
},
);
Expand Down
2 changes: 1 addition & 1 deletion server/test/hooks/activity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe("address activity", () => {

const deposits = await waitForDeposit(account, 1);

expect(captureException).toHaveBeenCalledWith(new Error("account deployment reverted"));
expect(captureException).toHaveBeenCalledWith(new Error("Transaction Timeout"), expect.anything());

expect(deposits).toHaveLength(0);
expect(response.status).toBe(200);
Expand Down

0 comments on commit ec1644f

Please sign in to comment.