ex.Demystify() changes the exception's state that can cause some issues in some cases. For instance, "demystify" exceptions can affect existing systems that use Watson bug reports with some automation around stack traces of unhandled exceptions.
This PR adds an extension method ToStringDemystify that calls Demystify under the hood but then restored the original exception's state. This method is effectively pure.
This change gives a library client an option to decide how to demystify the error: permanently (ex.Demystify()) or just get demystified string once and leave the original error as is (ex.ToStringDemystified()).
ex.Demystify()
changes the exception's state that can cause some issues in some cases. For instance, "demystify" exceptions can affect existing systems that use Watson bug reports with some automation around stack traces of unhandled exceptions.This PR adds an extension method
ToStringDemystify
that callsDemystify
under the hood but then restored the original exception's state. This method is effectively pure.This change gives a library client an option to decide how to demystify the error: permanently (
ex.Demystify()
) or just get demystified string once and leave the original error as is (ex.ToStringDemystified()
).