Exceptions in custom module

Topics: Customizing Orchard, Writing modules
Jan 8, 2013 at 8:33 AM


We're developing a custom module for a project we're working on.
The module is split into a series of controllers/drivers/content types, all working nicely.

But we're having some issues regarding the exception handling. The module
connects to an external data source and thus is subject to some senarioes where
an error sometimes can occur. But how to we force an error from a driver to generate
the display of an error page. Currently, if the driver throws an exception that exception
is caught, logged from a call in the InvokeExtensions class, but it is NOT displayed to the
end user, as Orchard doesn't see the exceptions as being fatal.

How do we force that to happen? Is there any way to extend/setup Orchard forcing some
custom Exceptions to be fatal as well, resulting in an error 500 page?

Otherwise we would have to catch all possible exceptions in all of our drivers and return
som kind of html-fragment telling the enduser that an error has occurred, but that error
could be burried in the middle of an otherwise completly valid page..

Or is our approach to the error handling totally wrong here?