Skip to content

Commit f984cdc

Browse files
committed
chore(daemon): label uncaughtException/unhandledRejection log output
Tag the catch-all error handlers' terminal and console output with an explicit `[uncaughtException]` / `[unhandledRejection]` prefix so the source of error blobs in daemon logs is identifiable at a glance.
1 parent e99777c commit f984cdc

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/cli/commands/daemon.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,17 @@ export default class Daemon extends Command {
207207
}
208208

209209
// Write real errors to both the terminal and the log file
210-
const writeErrorToTerminal = (err: unknown) => {
210+
const writeErrorToTerminal = (label: string, err: unknown) => {
211211
const msg = err instanceof Error ? err.stack || err.message : String(err);
212-
stderrWrite(msg + EOL);
212+
stderrWrite(`[${label}] ${msg}${EOL}`);
213213
};
214214
process.on("uncaughtException", (err) => {
215-
writeErrorToTerminal(err);
216-
console.error(err);
215+
writeErrorToTerminal("uncaughtException", err);
216+
console.error("[uncaughtException]", err);
217217
});
218218
process.on("unhandledRejection", (err) => {
219-
writeErrorToTerminal(err);
220-
console.error(err);
219+
writeErrorToTerminal("unhandledRejection", err);
220+
console.error("[unhandledRejection]", err);
221221
});
222222

223223
process.on("exit", () => {

0 commit comments

Comments
 (0)