Skip to content

Commit f1e4ad7

Browse files
committed
feat: ultraworkers#156 — error classification for text-mode output (Phase 2 of ultraworkers#77)
## Problem ultraworkers#77 Phase 1 added machine-readable error `kind` discriminants to JSON error payloads. Text-mode (stderr) errors still emit prose-only output with no structured classification. Observability tools (log aggregators, CI error parsers) parsing stderr can't distinguish error classes without regex-scraping the prose. ## Fix Added `[error-kind: <class>]` prefix line to all text-mode error output. The prefix appears before the error prose, making it immediately parseable by line-based log tools without any substring matching. **Examples:** ## Impact - Stderr observers (log aggregators, CI systems) can now parse error class from the first line without regex or substring scraping - Same classifier function used for JSON (ultraworkers#77 P1) and text modes - Text-mode output remains human-readable (error prose unchanged) - Prefix format follows syslog/structured-logging conventions ## Tests All 179 rusty-claude-cli tests pass. Verified on 3 different error classes. Closes ROADMAP ultraworkers#156.
1 parent 14c5ef1 commit f1e4ad7

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,21 @@ fn main() {
223223
"hint": hint,
224224
})
225225
);
226-
} else if message.contains("`claw --help`") {
227-
eprintln!("error: {message}");
228226
} else {
229-
eprintln!(
230-
"error: {message}
227+
// #156: Add machine-readable error kind to text output so stderr observers
228+
// don't need to regex-scrape the prose.
229+
let kind = classify_error_kind(&message);
230+
if message.contains("`claw --help`") {
231+
eprintln!("[error-kind: {kind}]
232+
error: {message}");
233+
} else {
234+
eprintln!(
235+
"[error-kind: {kind}]
236+
error: {message}
231237
232238
Run `claw --help` for usage."
233-
);
239+
);
240+
}
234241
}
235242
std::process::exit(1);
236243
}

0 commit comments

Comments
 (0)