Skip to content
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

Add error handling in case API doesn't return #1

Open
w3b3 opened this issue Jul 30, 2021 · 0 comments
Open

Add error handling in case API doesn't return #1

w3b3 opened this issue Jul 30, 2021 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@w3b3
Copy link
Owner

w3b3 commented Jul 30, 2021

This screenshot illustrates the issue:
image

Reproduction steps / History

  • This is the very first deploy to Vercel.
  • No Env were configured (yet)
  • API calls are running like https://undefined-undefined.astra.etc...
  • fetch is returning a TypeError (it is caught by a try-catch block and returning the exception from catch).
  • e: TypeError: NetworkError when attempting to fetch resource.
  • So... the API response (a bad one) is being fed to the UI
  • One of the things the UI does is doing some array operations on the response (sort, then map) and this is where it is errors out (unhandled error).
  • TypeError: C.sort is not a function

Ideas:

  • Update the return from API catch block.
  • Validate response in UI, not passing down if data is not a valid Array.
  • Also: can we add the famous Error Boundary here? (I know we can, but the real question is: should we?)
@w3b3 w3b3 self-assigned this Jul 30, 2021
@w3b3 w3b3 added the documentation Improvements or additions to documentation label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant