Custom Exception Handling Event
fastbike opened this issue · 2 comments
Allow custom exception handling for application defined Exception types.
E.g. I have a custom exception (EFHIRException) that has additional properties and a method to render it as an XML string. I have added a function "AsXMLString" to the exception class.
I have made a change to the TMVCEngine class and added an event property to surface the Exception prior to standard exception handling occurring.
TMVCExceptionEvent = procedure(E: Exception; SelectedController: TMVCController; WebContext: TWebContext; var ExceptionHandled: Boolean) of object;
Assign an event handler to the MVCEngine object and set ExceptionHandled to true if your code has handled/rendered the Exception.
I will post proposed changes and a simple sample project.
Looking for feedback and improvements, and hopefully a git pull request into the code base.
Issue191.zip
MVCEngine change and Sample Project attached
Basic idea and a refactored sample has been merged into the repo. Thank you for your contribution.