feat: display detailed error messages when prepare step fails (#82)
* feat: display detailed error messages when prepare step fails - Capture prepare step errors in action.yml (up to 2000 chars) - Add error details to comment update with collapsible section - Handle both prepare and Claude execution failures separately - Add test coverage for error detail display This helps users debug issues like git errors, permission problems, and branch creation failures more easily. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: simplify error capture to show clean error messages only - Remove complex shell script that captured full output logs - Use core.setOutput in prepare.ts to pass clean error message directly - Avoid exposing potentially sensitive information from logs - Show only the actual error message (e.g. 'Failed to fetch issue data') This provides cleaner, more readable error messages without the risk of exposing sensitive information from debug logs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: simplify error display to show clean error messages only - Remove collapsible <details> section for error messages - Display errors in simple code blocks since messages are now clean and short - Makes error messages more direct and readable 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,25 @@ describe("updateCommentBody", () => {
|
||||
expect(result).toContain("**Claude encountered an error after 45s**");
|
||||
});
|
||||
|
||||
it("includes error details when provided", () => {
|
||||
const input = {
|
||||
...baseInput,
|
||||
currentBody: "Claude Code is working...",
|
||||
actionFailed: true,
|
||||
executionDetails: { duration_ms: 45000 },
|
||||
errorDetails: "Failed to fetch issue data",
|
||||
};
|
||||
|
||||
const result = updateCommentBody(input);
|
||||
expect(result).toContain("**Claude encountered an error after 45s**");
|
||||
expect(result).toContain("[View job]");
|
||||
expect(result).toContain("```\nFailed to fetch issue data\n```");
|
||||
// Ensure error details come after the header/links
|
||||
const errorIndex = result.indexOf("```");
|
||||
const headerIndex = result.indexOf("**Claude encountered an error");
|
||||
expect(errorIndex).toBeGreaterThan(headerIndex);
|
||||
});
|
||||
|
||||
it("handles username extraction from content when not provided", () => {
|
||||
const input = {
|
||||
...baseInput,
|
||||
|
||||
Reference in New Issue
Block a user