@alexmngn wrote:
Hi there,
I am currently building an app and I am wondering what would be the best approach to catches the errors locally and globally.
Example of a local error handling:
The user enters information into a form, would like to throw/send/notify that there is an error, and the locally-defined error handler catches it and displays the error on top of the form. This should be defined at the component or controller level I guess, but how? If it's an unexpected error, it would bubble to the global error handler.
Example of a global error handling:
If the user upload an image and the image doesn't match with the requirement, I would like to throw/send/notify that there is an error with the image to a globally defined error handler. Should this be defined in the app route? app controller? This error handler would then either log the error (for unexpected error), or display the expected error to the user in a modal, defined at the app level of the app.
If you have any example where you treat the errors that way, or if you think it should be treated in a different way, I would really like to have your opinion on this.
Thanks
Posts: 2
Participants: 2