fix(ui): preserve AxiosError in the response interceptor - #259
Conversation
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Axios response error interceptor in the API client was modified to preserve the original AxiosError instance. Instead of rejecting a newly constructed Error object, it now mutates the message field on the existing error and rejects that same instance, retaining fields like response and status. ChangesAxios Error Preservation
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The global response interceptor rejected with a fresh Error(message), throwing away the original AxiosError and with it response, status, and data. Call sites that branch on those fields silently stopped working: GitHub sync errored instead of showing the not-linked empty state, and several forms fell back to a generic message instead of the backend's specific one. Attach the friendly text to error.message and reject the original error so status- and body-based handling keeps working. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
371e811 to
a2ad9f8
Compare
Summary
Closes #136.
The global Axios response interceptor rejected with a brand-new
Error(message), discarding the originalAxiosErrorand with itresponse,response.status, andresponse.data. Call sites that branch on those fields had silently stopped working:integrationService.githubGetProjectSynccheckserr.response.status === 404to returnnull("repo not linked yet"). With the field gone, a 404 threw instead of rendering the empty state.InviteSignUpPageand severalSettingsPagehandlers readerr.response.data.errorto surface the backend's specific validation message, and always fell back to a generic "Something went wrong."The interceptor now attaches the friendly text to
error.messageand rejects the originalAxiosError, soerror.messageconsumers keep the readable text while status- and body-based branches work again.Testing
npm run typecheckandnpm run lintpass.isAxiosError === true,response.status === 404,response.data.erroris the backend message, andmessageis the friendly text. Before the fix the same request rejected with a bareError(noresponse).AI assistance
This change was produced with the help of Claude Code (Claude Opus 4.8). See the
Co-Authored-Bytrailer on the commit.Summary by CodeRabbit