Is adding information to Exception.Data frowned upon?

  • Thread starter Thread starter Zytan
  • Start date Start date
Z

Zytan

I have a function that accepts an Exception, and writes out all of its
information to a log. This function is called in many places where an
exception is caught. In some places, I'd like to add one more bit of
information to the log. I could just write it out to the log there,
or, I could add it to the Exception.Data dictionary.

I am wondering if it is 'bad' to edit Data in a system exception?

I realize that Exception.Data is mainly used by programmers in their
own exception types, so this is likely not common. Also, note that I
am not rethrowing the exception, so I am not creating a new exception
(with the old one tucked away as an InnerException) with which I would
create my own Data dictionary.

Zytan
 
Zytan,
That is precisely what the Data collection is for - to add additional
information to an Exception object. Have fun.
Peter
 
Back
Top