Migrate 26 high-value catch sites to AppError taxonomy (C6 wave 1)

Classify scheduler, orchestration, IPC read, and automation catch
blocks via logAppError + classifyUnknownError so each failure surfaces
a stable `module.subdomain.condition` code plus a kind. No behaviour
change — returns, throws, and fall-through are preserved; only log
prefixes and the taxonomy metadata are new.

Wave 1 coverage (26 sites, all non-database):

  - orchestration/scheduler-lock-recovery (3)
  - orchestration/scheduler-housekeeping (5)
  - orchestration/scheduler-idle-automation (2)
  - orchestration/scheduler-heartbeat (4)
  - orchestration/turn-context (2)
  - ipc-core-read-handlers (6)
  - automation/automation-handlers (4)

Relax the Logger interface so `error` is optional, letting callers
whose deps expose only `{info, warn}` (scheduler contexts) pass in
directly without wrapping. The helper falls back to warn when error
is absent.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-20 13:37:40 -04:00
1 parent 118e3d8795
commit 827f06f358
8 files changed
+158 -32

No files matched your search

+4 -2
View File
@@ -9,7 +9,7 @@
import { classifyUnknownError, type AppError, type AppErrorMeta } from "./taxonomy.js";
export interface Logger {
error: (...args: unknown[]) => void;
error?: (...args: unknown[]) => void;
warn?: (...args: unknown[]) => void;
}
@@ -41,8 +41,10 @@ export function logAppError(
if (causeDetail) parts.push(`cause=${causeDetail}`);
if (level === "warn" && typeof logger.warn === "function") {
logger.warn(...parts);
} else {
} else if (typeof logger.error === "function") {
logger.error(...parts);
} else if (typeof logger.warn === "function") {
logger.warn(...parts);
}
return err;
}