Insert Error Show on Notification


I created a screen in our already existing radzen project, in order to have a UI support when adding a new row to a table.

I have a SQL Instead of Trigger for this table which checks for the conditions of an insert. It starts like this:

If the conditions are not met, it throws like this:
The throw number is not special, I can go with any.

When I try to add a conflicting row to this table, the error I get in radzen app is as following:

{"error":{"code":"","message":"An error occurred while updating the entries. See the inner exception for details.","details":[{"code":"","message":"An error occurred while updating the entries. See the inner exception for details."}]}}

But I want to show the meaningful message to the users, so that they know what the problem is. Can you please help me with this?


Hi @ozgur_agi ,

Radzen returns the exact error message which is returned by Entity Framework. We can't do much beyond that. I suggest you break with the debugger to see if the exception contains more meaningful details.

It actually does, here is an example from radzen output. Do you have any means to take this to the frontend?

Hi @ozgur_agi

You can try adding the controller to Radzen’s code generation ignore list and changing this code

ModelState.AddModelError("", ex.Message)

Replace ex.Message with the property that contains the actual error.

1 Like

Solved it. :slight_smile:

Here is the solution for the future:

ModelState.AddModelError("", ex.InnerException.Message);

Thank you,