Nick M
Nick M

Reputation: 2532

Show user-friendly error messages in Vue application

As with any application a number of things can go wrong sooner or later. I have a large Vue application that sometimes throws some errors (I know, it shouldn't, but sometimes it does anyway) and I'd like to show a friendly message to the user so they won't be stuck waiting. Like a "generic error handler" of some kind on the window object.

I tried this: javascript: how to display script errors in a popup alert? but it does not fire.

Any other suggestions?

Upvotes: 1

Views: 1619

Answers (1)

sandrooco
sandrooco

Reputation: 8756

You could redirect to a generic error page which displays an error ID and the message (if given).

A different way would be to display toasts and stay on the page, which will allow the user to retry actions. I recommend vue-toasted for toasts in vue projects.

Upvotes: 2

Related Questions