-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance DOI Search Error Handling #450
Conversation
…rrors when API responses are not OK
akita
|
Project |
akita
|
Branch Review |
issue-2286
|
Run status |
|
Run duration | 01m 50s |
Commit |
|
Committer | Joseph Rhoads |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
3
|
|
0
|
|
50
|
View all changes introduced in this branch ↗︎ |
…search and works listing
…fy error and empty state handling
…rror and empty state handling
…combine error and empty state handling
…pecific entity-based messages
@@ -23,34 +22,15 @@ export default function SearchOrganizations(props: Props) { | |||
|
|||
if (loading) return <Row><Loading /></Row> | |||
|
|||
if (error) return ( | |||
const organizations = data?.organizations | |||
if (error || !organizations || organizations.nodes.length == 0) return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we may want to keep the granularity of splitting the error out from no results and showing the error component? @jrhoads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we ever want to in the future, we can split this up again.
options | ||
) | ||
const json = await res.json() | ||
if(!res.ok) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do the error handling this way on all the REST fetches? @jrhoads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. We had been catching the error. React/Tanstack query expects an error to be thrown. Otherwise it never populates the error state.
akita
|
Project |
akita
|
Branch Review |
1.18.1
|
Run status |
|
Run duration | 02m 00s |
Commit |
|
Committer | Joseph Rhoads |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
3
|
|
0
|
|
50
|
View all changes introduced in this branch ↗︎ |
Purpose
Improve error handling and response processing in DOI search and facets queries to provide more informative error messages and ensure proper error propagation.
Approach
The changes enhance the error handling mechanism for DOI search and facets API requests by:
Key Modifications
fetchDois
andfetchDoisFacets
functionsImportant Technical Details
NoResults
component that can be used across different search typesTypes of changes
The changes improve error handling by providing more transparent and informative error messages during DOI search API requests, making debugging and error tracking more straightforward.
Reviewer, please remember our guidelines: