[800] [S4] Add request timeout and standardise error parsing in the API client#818
Merged
Conversation
Centralises API error message extraction and adopts it across all API catch blocks. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Goodnessukaigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…error-parsing-in-the-api-client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
10_000ms)parseApiError(err: unknown): stringhelper innevo_frontend/lib/errors.tsAPI timeout configuration
The
ApiClientdefault timeout is changed from 15s to 10s. Individual requests can still override via the existingtimeoutoption inRequestConfig.parseApiError design
Resolution order:
response.data.messageresponse.data.errorApiError.data.message/ApiError.data.error(fetch-based client)Error.message"Something went wrong. Please try again."Uses manual type guards for axios-shaped errors (no axios dependency added — the client uses
fetch).Migrated error-handling locations
src/store/poolsStore.ts—fetchPools,fetchPoolapp/login/page.tsx— authentication flowapp/profile/page.tsx— profile saveapp/pools/new/page.tsx— pool creation submit (validation 400 handling unchanged)app/pools/[id]/page.tsx— pool closecomponents/DonateModal.tsx— donation flowValidation results
npm run buildpasses__tests__/errors.test.tscovering axios shapes,ApiError, network/fallback casesCloses #800
Made with Cursor