Skip to content

Commit 2dab3f2

Browse files
authored
Revert "feat: enhance error reporting with specific error types from Claude e…" (anthropics#179)
This reverts commit 1b94b9e.
1 parent 1b94b9e commit 2dab3f2

2 files changed

Lines changed: 11 additions & 44 deletions

File tree

src/entrypoints/update-comment-link.ts

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ async function run() {
147147
} | null = null;
148148
let actionFailed = false;
149149
let errorDetails: string | undefined;
150-
let errorSubtype: string | undefined;
151150

152151
// First check if prepare step failed
153152
const prepareSuccess = process.env.PREPARE_SUCCESS !== "false";
@@ -167,40 +166,23 @@ async function run() {
167166
// Output file is an array, get the last element which contains execution details
168167
if (Array.isArray(outputData) && outputData.length > 0) {
169168
const lastElement = outputData[outputData.length - 1];
170-
if (lastElement.type === "result") {
171-
// Extract execution details
169+
if (
170+
lastElement.type === "result" &&
171+
"cost_usd" in lastElement &&
172+
"duration_ms" in lastElement
173+
) {
172174
executionDetails = {
173-
cost_usd: lastElement.total_cost_usd,
175+
cost_usd: lastElement.cost_usd,
174176
duration_ms: lastElement.duration_ms,
175177
duration_api_ms: lastElement.duration_api_ms,
176178
};
177-
178-
// Check if this is an error result based on subtype
179-
switch (lastElement.subtype) {
180-
case "error_during_execution":
181-
errorSubtype = "Error during execution";
182-
// Override the actionFailed flag based on the result
183-
actionFailed = true;
184-
break;
185-
case "error_max_turns":
186-
errorSubtype = "Maximum turns exceeded";
187-
actionFailed = true;
188-
break;
189-
}
190179
}
191180
}
192181
}
193182

194-
// Check if the Claude action failed (only if not already determined from result)
195-
if (!actionFailed) {
196-
const claudeSuccess = process.env.CLAUDE_SUCCESS !== "false";
197-
actionFailed = !claudeSuccess;
198-
}
199-
200-
// Use errorSubtype as errorDetails if no other error details are available
201-
if (actionFailed && !errorDetails && errorSubtype) {
202-
errorDetails = errorSubtype;
203-
}
183+
// Check if the Claude action failed
184+
const claudeSuccess = process.env.CLAUDE_SUCCESS !== "false";
185+
actionFailed = !claudeSuccess;
204186
} catch (error) {
205187
console.error("Error reading output file:", error);
206188
// If we can't read the file, check for any failure markers

src/github/operations/comment-logic.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ export function updateCommentBody(input: CommentUpdateInput): string {
114114

115115
if (actionFailed) {
116116
header = "**Claude encountered an error";
117-
118-
// Add error type to header if available
119-
if (errorDetails) {
120-
if (errorDetails === "Error during execution") {
121-
header = "**Claude encountered an error during execution";
122-
} else if (errorDetails === "Maximum turns exceeded") {
123-
header = "**Claude exceeded the maximum number of turns";
124-
}
125-
}
126-
127117
if (durationStr) {
128118
header += ` after ${durationStr}`;
129119
}
@@ -191,13 +181,8 @@ export function updateCommentBody(input: CommentUpdateInput): string {
191181
// Build the new body with blank line between header and separator
192182
let newBody = `${header}${links}`;
193183

194-
// Add error details if available (but not if it's just the error type we already showed in header)
195-
if (
196-
actionFailed &&
197-
errorDetails &&
198-
errorDetails !== "Error during execution" &&
199-
errorDetails !== "Maximum turns exceeded"
200-
) {
184+
// Add error details if available
185+
if (actionFailed && errorDetails) {
201186
newBody += `\n\n\`\`\`\n${errorDetails}\n\`\`\``;
202187
}
203188

0 commit comments

Comments
 (0)