I have created an application in Blazor with C#, JavaScript, HTML and CSS and would like to receive a pop-up with the message from the try-catch block in case of an error, like this:
try{ // Here is my code}catch (Exception ex){ // alert(ex.Message); something like that // Here I want the window alert}Does anyone have an idea how I can do this? It doesn't necessarily have to be a window alert, but I want a notification that pops up when entering the catch block with the error message.
i try this:
try{ // Here is my code}catch (Exception ex){throw new InvalidOperationException(ex.Message);alert(ex.Message);}the first one didn't work and the second one comes to error --> Error CS0103 The name 'alert' does not exist in the current context