Skip to content

Commit 5eba938

Browse files
committed
Restore rich error message context in git error classes
The message getters for GitCommandError, GitHubCliError, TextGenerationError, and GitManagerError in contracts were returning only this.detail, losing the operation, command, and cwd context that the original local definitions included. Restore the formatted messages so that logging and error reporting surfaces full debugging context.
1 parent d7ec9d6 commit 5eba938

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/contracts/src/git.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(
232232
cause: Schema.optional(Schema.Defect),
233233
}) {
234234
override get message(): string {
235-
return this.detail;
235+
return `Git command failed in ${this.operation}: ${this.command} (${this.cwd}) - ${this.detail}`;
236236
}
237237
}
238238

@@ -242,7 +242,7 @@ export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("G
242242
cause: Schema.optional(Schema.Defect),
243243
}) {
244244
override get message(): string {
245-
return this.detail;
245+
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
246246
}
247247
}
248248

@@ -255,7 +255,7 @@ export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationE
255255
},
256256
) {
257257
override get message(): string {
258-
return this.detail;
258+
return `Text generation failed in ${this.operation}: ${this.detail}`;
259259
}
260260
}
261261

@@ -265,7 +265,7 @@ export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()(
265265
cause: Schema.optional(Schema.Defect),
266266
}) {
267267
override get message(): string {
268-
return this.detail;
268+
return `Git manager failed in ${this.operation}: ${this.detail}`;
269269
}
270270
}
271271

0 commit comments

Comments
 (0)