Exception Handling when calling REST services

Hi!

I have added a REST web service as data source. In my page, I added a button and in the click event of the button I used "invoke data source method" to call a method from my API.

I also added in the "then" branch that the result should be stored in a variable and in the "error" branch, I added a "show notification" in order to report the error to the user.

When running the code and is comes to an error (e.g. server not available), the Blazor app crashes. I checked the generated source file, and in fact, there is no try...catch. That is why the app crashes. Also, there is no sign of the "error" branch which should show the notification to the user. Is this a bug or am I doing something wrong here?

This is how the generated code looks like:

        protected async System.Threading.Tasks.Task Button0Click(MouseEventArgs args)
        {
                var myApiGetGenerateKeyResult = await myApi.GetGenerateKey($"Some", $"Parameters", $"Here");
                Test = myApiGetGenerateKeyResult;
        }
    }

Thanks for your help on this...

Best regards,

Joe

Make sure you have set severity of the Notification:


That did the trick! Thanks!