1

VS2013 VB or C#

After an exception is raised we can see some of its properties are defined as Public Overridable:

ex.source
ex.helplink

But other properties are defined as strictly Public Read Only:

ex.innerexception
ex.targetsite

Yet others are defined as Public Overridable Read Only:

ex.data
ex.message

In the SO post at this link Simon Weaver nicely shows how to wrap an exception so a custom message can be delivered through the elmah logging system. When I found Simon's solution I was trying to see if the standard Microsoft User-Defined Exceptions Class could be changed to allow the properties currently defined as Public Overridable Read Only to actually be overridden.

So that's my question, as a learning pursuit. Simon's solution works great for me to get 'private notes' into the error log that don't really rise to the level of a major exception. I just wondered if the User Defined Exceptions Class could be modified to allow directly setting/modifying a different exception property viewable in elmah instead of using a call to a method with it's subsequent creation of a wrapped exception.

Community
  • 1
  • 1
Alan
  • 1,409
  • 2
  • 21
  • 35

0 Answers0