Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Exception Handling Event #191

Closed
fastbike opened this issue Feb 23, 2019 · 2 comments
Closed

Custom Exception Handling Event #191

fastbike opened this issue Feb 23, 2019 · 2 comments
Labels
accepted Issue has been accepted and inserted in a future milestone

Comments

@fastbike
Copy link
Contributor

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.

@fastbike
Copy link
Contributor Author

Issue191.zip
MVCEngine change and Sample Project attached

@danieleteti danieleteti added the accepted Issue has been accepted and inserted in a future milestone label Feb 24, 2019
@danieleteti danieleteti added this to the 3.1.1 (beryllium) milestone Feb 24, 2019
@danieleteti
Copy link
Owner

Basic idea and a refactored sample has been merged into the repo. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue has been accepted and inserted in a future milestone
Projects
None yet
Development

No branches or pull requests

2 participants