csla icon indicating copy to clipboard operation
csla copied to clipboard

Add an OnError Event to the Blazor ViewModel

Open mtavares628 opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I'd like to be able to react when a save fails and perform an action in my code when this happens. For example if a concurrency violation occurs during the save, I would like to pop up a modal and give the user an option to override the changes in the system or cancel them. While I'm currently doing this now with the ViewModelErrorText updating on the page, I don't see a way to trigger the modal when the ViewModelErrorText changes.

Describe the solution you'd like I would like to see an Error event get invoked when an exception occurs during the save process. It could also be invoked when there is an error in the refresh as well.

Describe alternatives you've considered I tried to potentially override the SaveAsync method on the ViewModel, but found myself rewriting the whole thing because I'm not able to set the Exception property in my inherited class, since it has a private setter.

mtavares628 avatar Mar 24 '23 21:03 mtavares628

Good suggestion, thanks!

rockfordlhotka avatar Mar 30 '23 21:03 rockfordlhotka