fix(core): preserve structured error messages (#33530)

This commit is contained in:
Aiden Cline 2026-06-23 18:43:59 -05:00 committed by GitHub
commit c17b9557f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 73 additions and 9 deletions

View file

@ -10,7 +10,14 @@ export class AppProcessError extends Schema.TaggedErrorClass<AppProcessError>()(
exitCode: Schema.optional(Schema.Number),
stderr: Schema.optional(Schema.String),
cause: Schema.optional(Schema.Defect()),
}) {}
}) {
override get message() {
const detail =
this.stderr?.trim() || (this.cause instanceof Error ? this.cause.message : this.cause && String(this.cause))
const status = this.exitCode === undefined ? "" : ` (exit ${this.exitCode})`
return `Command failed${status}: ${this.command}${detail ? `: ${detail}` : ""}`
}
}
export interface RunOptions {
readonly maxOutputBytes?: number