Skip to content

Commit cbf7fa5

Browse files
fix(forgejo): tea API failures keep Gitea's reason
tea writes Gitea's error body to stdout and exits zero, so generic HTTP failures only said "Forgejo API request failed (HTTP 405)." Include the trimmed body in the detail, as the fj path already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 33a692d commit cbf7fa5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/source-control-forgejo/src/server/ForgejoCli.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,8 @@ export const make = Effect.gen(function* () {
706706
});
707707
// tea reports HTTP failures with exit code zero; use its response status.
708708
const status = Number(/^HTTP\/\S+ (\d{3})/m.exec(result.stderr)?.[1]);
709-
if (!status || status >= 400)
709+
if (!status || status >= 400) {
710+
const body = result.stdout.trim();
710711
return yield* new ForgejoCliError({
711712
command: "tea",
712713
cwd: input.cwd,
@@ -727,8 +728,13 @@ export const make = Effect.gen(function* () {
727728
? "Forgejo repository or pull request was not found."
728729
: status === 429
729730
? "Forgejo API rate limit exceeded."
730-
: `Forgejo API request failed${status ? ` (HTTP ${status})` : " without an HTTP status"}.`,
731+
: !status
732+
? "Forgejo API request failed without an HTTP status."
733+
: body
734+
? `Forgejo API request failed (HTTP ${status}): ${body}`
735+
: `Forgejo API request failed (HTTP ${status}).`,
731736
});
737+
}
732738
return result;
733739
});
734740
return ForgejoCli.of({ execute, listLogins, getAccount, resolveRepository, api });

0 commit comments

Comments
 (0)