Skip to content

fix: extract error messages correctly from nested API error responses#328

Merged
icebear0828 merged 1 commit intomasterfrom
fix/settings-error-extraction
Apr 8, 2026
Merged

fix: extract error messages correctly from nested API error responses#328
icebear0828 merged 1 commit intomasterfrom
fix/settings-error-extraction

Conversation

@icebear0828
Copy link
Copy Markdown
Owner

Summary

  • Dashboard settings hooks were casting {error: {message: "..."}} as {error: string}, showing [object Object] to the user on 500 errors — making them impossible to debug from the UI
  • Added shared/utils/extract-error.ts that handles both flat ({error: "msg"}) and nested ({error: {message: "msg"}}) error formats
  • Fixed all 4 settings hooks: use-settings, use-general-settings, use-quota-settings, use-rotation-settings
  • Added shared/** to vitest include paths

Test plan

  • Unit tests for extractErrorMessage (6 cases: flat, nested, null, empty, non-string, nested non-string)
  • Full test suite passes (114 files, 1320 tests)

Dashboard settings hooks were casting `{error: {message: "..."}}` as
`{error: string}`, resulting in `[object Object]` shown to the user —
making 500 errors impossible to debug from the UI.
@icebear0828 icebear0828 merged commit 012026c into master Apr 8, 2026
1 check passed
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