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

Create a global "catcher" for errors in the UI #465

Closed
kinow opened this issue Jun 18, 2020 · 1 comment · Fixed by #497
Closed

Create a global "catcher" for errors in the UI #465

kinow opened this issue Jun 18, 2020 · 1 comment · Fixed by #497
Assignees
Milestone

Comments

@kinow
Copy link
Member

kinow commented Jun 18, 2020

Describe exactly what you would like to see in an upcoming release

At the moment we have both promises and async code. Not all promises are being .catch()'ed, meaning the error is just being propagated until it appears in the console.

The async code has the try/catch pattern. And other promises have the setAlert or SET_ALERT action or mutation. But writing that over and over in separate components it a bit tedious. That's not something that can be easily fixed with mixins. HOC could work, but would require a common interface for views/components.

Additional context

This article has, among other good tips and examples, an ErrorBoundary component that could be useful as reference: https://michaelzanggl.com/articles/vue-cleaning-up-components/

image

It uses Vue's errorCaptured.

That should work well with components. Not sure if that will work with views (maybe adding to Default.vue layout).

We could also deprecate the Alert model and associated code, if we are able to get something like BootstrapVue's toast.

Instead of using Vuex and requiring code to call the mutation/action, in BootstrapVue there's a global object to create toasts, which takes care to position the alerts.

image

That's simpler than having to import and map the action or mutation

image

to then call it

image

Plus the code for Alert.model.js and the Vuex code in src/store/index.js.

Pull requests welcome!

@kinow kinow added this to the 0.3 milestone Jun 18, 2020
@kinow
Copy link
Member Author

kinow commented Jun 19, 2020

Spent a few minutes working on this, then found that instead of using an Alert component, it might be better to use a Snackbar. The Snackbar is the same component used by the ConnectionStatus component, that puts the red tooltip at the top of the screen when the WebSocket connection breaks.

Snackbars appear to be unique on the screen, without being able to be stacked yet, as in Buefy or BootstrapVue, see vuetifyjs/vuetify#2384

Also found that there are new releases of Vuetify, and we are using deprecated API. Better to update soon, rather than late, so that we don't end up with a broken UI due to an update after they remove the deprecated API.

@kinow kinow changed the title Create a glocal "catcher" for errors in the UI Create a global "catcher" for errors in the UI Jun 19, 2020
@kinow kinow self-assigned this Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant