Skip to content

Commit 7529ea8

Browse files
committed
fix(webapp): preserve preexisting 400 status in two catches, just hide leak
The previous sweep collapsed two existing 400 branches to 500 along with the leak-sanitization. Keep the 400 status — the inner branches were catching errors that callers had been informed of via 400, and clients may depend on that. Just replace the leaky `error.message` body with a generic per-route message. - api.v1.orgs.$orgParam.projects.ts (createProject failure): 500 → 400 with `"Failed to create project"`. - api.v1.authorization-code.ts (instanceof Error branch): 500 → 400 with `"Failed to create authorization code"`. Both branches probed locally: synthetic failure forces the path and the response is the documented 400 + generic body.
1 parent 1c88aed commit 7529ea8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/webapp/app/routes/api.v1.authorization-code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function action({ request }: ActionFunctionArgs) {
3232
error: error.message,
3333
});
3434

35-
return json({ error: "Internal Server Error" }, { status: 500 });
35+
return json({ error: "Failed to create authorization code" }, { status: 400 });
3636
}
3737

3838
return json({ error: "Something went wrong" }, { status: 500 });

apps/webapp/app/routes/api.v1.orgs.$orgParam.projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
118118

119119
if (error) {
120120
logger.error("Failed to create project", { error });
121-
return json({ error: "Internal Server Error" }, { status: 500 });
121+
return json({ error: "Failed to create project" }, { status: 400 });
122122
}
123123

124124
const result: GetProjectResponseBody = {

0 commit comments

Comments
 (0)