Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

log: swallow rotation errors instead of risking unhandled rejection

Raine Virtafb029806bd92
diff --git a/src/log.ts b/src/log.ts
index 7a72b11..8f5e741 100644
--- a/src/log.ts
+++ b/src/log.ts
@@ -54,6 +54,8 @@ async function maybeRotate(): Promise<void> {
stream = undefined
}
await rename(file, rotated).catch(() => {})
+ } catch {
+ // Never propagate rotation errors — logging must never crash the proxy.
} finally {
rotating = undefined
}
@@ -94,7 +96,7 @@ async function write(level: Level, service: string, msg: string, fields?: Record
try {
const s = await ensureStream()
s.write(line + "\n")
- void maybeRotate()
+ maybeRotate().catch(() => {})
} catch {
// swallow; also print to stderr for visibility
}