fix(server): map Account failures to typed 500 instead of defect (#26448)

This commit is contained in:
Kit Langton
2026-05-08 23:44:28 -04:00
committed by GitHub
parent 11d9e82eaf
commit 3615d5aab1
3 changed files with 109 additions and 2 deletions

View File

@@ -82,6 +82,7 @@ export const ExperimentalApi = HttpApi.make("experimental")
.add(
HttpApiEndpoint.get("console", ExperimentalPaths.console, {
success: described(ConsoleStateResponse, "Active Console provider metadata"),
error: HttpApiError.InternalServerError,
}).annotateMerge(
OpenApi.annotations({
identifier: "experimental.console.get",
@@ -91,6 +92,7 @@ export const ExperimentalApi = HttpApi.make("experimental")
),
HttpApiEndpoint.get("consoleOrgs", ExperimentalPaths.consoleOrgs, {
success: described(ConsoleOrgList, "Switchable Console orgs"),
error: HttpApiError.InternalServerError,
}).annotateMerge(
OpenApi.annotations({
identifier: "experimental.console.listOrgs",

View File

@@ -26,7 +26,10 @@ export const experimentalHandlers = HttpApiBuilder.group(InstanceHttpApi, "exper
const getConsole = Effect.fn("ExperimentalHttpApi.console")(function* () {
const [state, groups] = yield* Effect.all(
[config.getConsoleState(), account.orgsByAccount().pipe(Effect.orDie)],
[
config.getConsoleState(),
account.orgsByAccount().pipe(Effect.catch(() => Effect.fail(new HttpApiError.InternalServerError({})))),
],
{
concurrency: "unbounded",
},
@@ -40,7 +43,10 @@ export const experimentalHandlers = HttpApiBuilder.group(InstanceHttpApi, "exper
const listConsoleOrgs = Effect.fn("ExperimentalHttpApi.consoleOrgs")(function* () {
const [groups, active] = yield* Effect.all(
[account.orgsByAccount().pipe(Effect.orDie), account.active().pipe(Effect.orDie)],
[
account.orgsByAccount().pipe(Effect.catch(() => Effect.fail(new HttpApiError.InternalServerError({})))),
account.active().pipe(Effect.catch(() => Effect.fail(new HttpApiError.InternalServerError({})))),
],
{
concurrency: "unbounded",
},