refactor-api-error-handling

backend-servicerefactor/api-error-handlingc91ab4215m+291-125

rg "throw new|timeout|ApiError" src/modules/api src/shared/errors

There are three different error shapes in the proxy flow: validation errors, upstream errors, and transport timeouts.

src/shared/errors/api-error.ts+76-18

src/shared/errors/error-presenter.ts+48-27

I consolidated timeout, validation, and upstream failures into a single response shape so clients can branch on stable error codes.

src/modules/api/controllers/proxy.controller.ts+24-19

src/modules/api/retry-policy.ts+37-12

src/modules/api/upstream-client.ts+41-26

The retry policy now converts upstream timeout responses into the same typed error before the controller formats the response.

pnpm test src/modules/api/tests/error-presenter.spec.ts

Unit coverage passes for validation, upstream 5xx, and timeout presentation. The remaining risk is the integration build.

pnpm build --filter backend-service

The retry build needs approval because the upstream API timed out during the final integration test.

I paused before retrying so the developer can decide whether to spend another CI attempt on the flaky upstream dependency.

Waiting approval