Capturing dao layer errors for front end display


I have a working application that can pull data via an api and display the data to the screen using razor pages.

I am trying to add error handling to the application. For example, when I try to insert a duplicate key row, the dao layer works fine and captures the error.

Currently, nothing is shown/alerted on screen and the user can't tell if the record saved or not.

How would I get that error message to make its way into the razor page to show the user?

thank you for any guidance.

Hi @Gary_Kagan,

Although your post is for Radzen IDE for WASM it seems that your are not using it? Not sure how your question is related to Radzen.

sorry about my question. Still learning this product to see if we will continue to use it. Nonetheless, still having issues trying to find support on how to get and display any db errors the razor pages. Is this something that you have any guidance on?

Pages generated by Radzen should already capture and display errors. Here is how a typical update operation looks like:

        protected async System.Threading.Tasks.Task Form0Submit(WasmDefaultSecurity.Models.Localhost.Order args)
                var localhostUpdateOrderResult = await Localhost.UpdateOrder(id:Id, order:order);
            catch (System.Exception localhostUpdateOrderException)
                NotificationService.Notify(new NotificationMessage(){ Severity = NotificationSeverity.Error,Summary = $"Error",Detail = $"Unable to update Order" });

ok, tried to apply this code

I also needed to add these to the razor page (not sure if that is correct)

@inject DialogService DialogService
@inject NotificationService NotificationService


public void ConfigureServices(IServiceCollection services)

code runs and I see a result in localhostUpdateFdidResult

good example of insert:

duplicate key example

only error i see in this variable is a js exception along with bad request.

(can't post more than 2 pictures)
'Invalid JS object handle '3''

Your code seems to be custom and not generated by the Radzen IDE. I am afraid we don't provide support for such scenarios - try debugging your application and inspecting the server-response.