Hey everyone! I’m trying to figure out how to edit the properties of an existing exception.
Example: newException = new Exception(“This is a test”)
Looking up newException.Message results in “This is a test”
Add to the message " and this is new"
Looking up newException.Message results in “This is a test and this is new”
How do I add to this while preserving the other properties of this exception? When I try defining it, I get this error:
I specifically want to be able to edit the Message and the StackTrace properties of an exception, but open to learning about changing other properties too.
I’m using a library that injects specific exception details in an email, but the library is written to accept the exception as an argument and then parse that information within the library. I’m trying to add additional information into the exception to help identify which queue item had issues and specific troubleshooting details to make it easier than having to look elsewhere.
Those details you can add to the exception data field and then when writing it somewhere you can access that data firld to get the info and append it when needed instead of modifying the message
Excep.Data("Key") = "value you want to append"
Data is like a dictionary so you can use it later by using the key you added…may be something liek extra_message