benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)
Apache License 2.0
2.76k stars 119 forks source link

Add pure ToStringDemystified extension method that does not change exception's state #60

Closed SergeyTeplyakov closed 6 years ago

SergeyTeplyakov commented 6 years ago

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()).

benaadams commented 6 years ago

Thank you

benaadams commented 6 years ago

In version 0.1.1 https://www.nuget.org/packages/Ben.Demystifier/0.1.1