Skip to content

SAS-172: Surface structured backend error messages instead of a generic fallback - #37902

Draft
rjimeno-mz wants to merge 1 commit into
mainfrom
rjimeno/sas-172-phase-7-return-structured-error-responses-with-safe-reason
Draft

SAS-172: Surface structured backend error messages instead of a generic fallback#37902
rjimeno-mz wants to merge 1 commit into
mainfrom
rjimeno/sas-172-phase-7-return-structured-error-responses-with-safe-reason

Conversation

@rjimeno-mz

@rjimeno-mz rjimeno-mz commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Regenerates the OpenAPI schema for the new ApiError type (cloud#13055).
  • Fixes a deeper bug found while wiring this up: openapi-fetch splits a response into data (2xx) or error (non-2xx), never both, but handleOpenApiResponse/handleOpenApiResponseWithBody only ever read data. A JSON error body could never reach the client regardless of backend changes. error is now an optional third parameter (backward compatible with all other call sites), wired through for getCostsBreakdownDaily.
  • Adds getApiError() (src/api/openApiUtils.ts) to extract the structured body from a caught error.
  • AccountSpendBreakdown now shows the backend's real message, and a request id (for non-validation reasons) instead of always showing a hardcoded generic string.

Test plan

  • yarn typecheck / yarn lint
  • New tests: structured error renders the real message + request id; validation errors render without a request id (nothing for support to look up); generic fallback still covers non-JSON/unmigrated error bodies
  • Full billing/api suites pass (166 tests)

Resolves SAS-172 (merges SAS-149 and SAS-164). Follow-up for the remaining endpoints/call sites: SAS-174.

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

SAS-172

@rjimeno-mz rjimeno-mz self-assigned this Jul 28, 2026
@rjimeno-mz rjimeno-mz changed the title Surface structured backend error messages instead of a generic fallback SAS-172: Surface structured backend error messages instead of a generic fallback Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant