-
Notifications
You must be signed in to change notification settings - Fork 310
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
Come up with a proper way to display errors in frontend #41
Comments
@kschiffer what is the action here, how does it relate to toast and should this be broken down in smaller issues? |
I have updated the issue to include the toast PR. There are some elements of discussion still, but I will split this one up in smaller issues. |
OK, I'll leave it in |
Some follow-up thoughts about non-fatal errors: To me, it appears to make sense to split non fatal errors into categories:
So for the time being, I think we should focus on the first category. My proposal would be to add a little Thoughts welcome. |
Closed via #667 |
Summary:
At the moment there is no real error handling on the frontend. We should make use of React's Error Boundaries here to scope error messages to their concerning components, as long as this is possible.
Additionally, we need a proper error page that will be shown when fatal errors occur that prevents the app from loading. This error page should match the static ones that are rendered by the backend.
Why do we need this?
Handling errors gracefully is essential for a UX that minimizes frustration. We should if possible also provide hints to the users as to how specific errors might be resolved.
What is already there? What do you see now?
There is some fragmented error handling already in place eg. for the login screen. Also we already have the necessary backend functionality to get error messages that have all the info that we need, as well as i18n capabilities. The
<ErrorMessage />
-component is specifically for this.If the backend encounters an error in HTTP under
/console
or/oauth
, it now renders HTML (if requested by browser in Accept header) with the error JSON inPAGE_DATA.error
.A request
curl -H "Accept: text/html" -XPOST http://localhost:1885/oauth/api/auth/login
results in the following (formatted for readability):Errors are structured in the same way as the errors you receive from the API, so with the
details
array, where you need to find the object with"@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails"
to get TTN error details.We probably need a broader error message strategy. Four error message scenarios come to mind:
<Notification />
component which can take error objects for display)I propose the following designs:
The component error overlay I could envision like this:
In page example:
So it would be sort of an enhanced form of
<Notification />
, which spans the whole width of the errored component and displays a specific support message. This example shows an error of the device list, which I don't know whether we should provide an error boundary for. But I think it's good to show how the error overlay would work.What is missing? What do you want to see?
A clear strategy for implementing this.
How do you propose to implement this?
By adding Error Boundaries via adding
componentDidCatch()
to all components in the webui that display fetched data and possibly adding a flag that will render the component as errored, which we should already add when we implement new components. This should also be put into storybook.What can you do yourself and what do you need help with?
I can do this.
cc @bafonins
Original issue: https://github.com/TheThingsIndustries/lorawan-stack/issues/1308 by @kschiffer
The text was updated successfully, but these errors were encountered: