Add Module Information to Exceptions
Note
To all public methods and property setters of classes that implement ILisrtModule a try-catch block is injected to add the module name to the exception.
Before code:
public class MyModule : ILisrtModule
{
public void Do()
{
InnerDo();
}
}
What gets compiled:
public class MyModule : ILisrtModule
{
public void Do()
{
try
{
InnerDo();
}
catch (Exception ex);
{
ex.AddModuleInformation(this);
throw;
}
}
}
Configure the Behavior via Attribute
Use the DoNotAddModuleInformationAttribute to exclude classes or methods from adding module information.
public class MyModule : ILisrtModule
{
[DoNotAddModuleInformation]
public void Do()
{
InnerDo();
}
}