Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/api/src/rpc/interceptors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { useLogger } from "evlog/elysia";

export function logOrpcHandlerError(error: unknown) {
// AbortError (name="AbortError", code=20) means the HTTP client closed the
// connection before the response was delivered. This is an expected network
// event (user navigates away, closes tab, mobile sleep) and is not a server
// fault — swallow it silently instead of creating noisy ERROR incidents.
if (error instanceof Error && error.name === "AbortError") {
return;
}
Comment on lines +8 to +10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Silent drop vs. debug log: the AbortError is currently discarded with no trace, which means there's no way to observe abort rates in verbose/debug log modes or correlate them with performance regressions. Logging at debug level (instead of return) would keep the ERROR incident feed clean while still allowing the signal to surface when needed.

Suggested change
if (error instanceof Error && error.name === "AbortError") {
return;
}
if (error instanceof Error && error.name === "AbortError") {
useLogger().debug(error, { rpc: "interceptor", aborted: true });
return;
}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

useLogger().error(error instanceof Error ? error : new Error(String(error)), {
rpc: "interceptor",
});
Expand Down
Loading