Instead of "Internal Server Error" we would like to show meaningful Exception messages on the client. For example If any error occurs in a service method. We just want to show that messages via a pop-up on our Angular (v6) web client. But every messages coming to UI with a standart "An internal error occured during your request" and with 500 status code. Looking forward your help.
Regards.
4 Answer(s)
-
1
Throw
UserFriendlyException
.https://aspnetboilerplate.com/Pages/Documents/Handling-Exceptions#showing-exceptions
-
0
Thanks for the answer. If we throw the specific exception with UserFriendlyException it is appearing on the UI. But I would like to implement this behaviour for all exceptions are coming from aspnet-core server application. In which code block should implement this solution to catch and convert them to user friendly exceptions ?
-
0
You can set
SendAllExceptionsToClients = true
.https://aspnetboilerplate.com/Pages/Documents/Startup-Configuration#configuring-modules
-
0
@hsudas
Some exceptions should not be shown to the user. For example: database errors, exceptions that occur in the helper component, etc.
You can control exceptions, preferably using
UserFriendlyException
.