C# exception handling
All exceptions extend Exception, which has a Data dictionary. The dictionary can be used to include additional information about an error.
You can decorate exceptions generated by external code too. Add a try/catch:
You can decorate exceptions generated by external code too. Add a try/catch:
try
{
service.SomeCall();
}
catch (Exception e)
{
e.Data.Add("user", Thread.CurrentPrincipal.Identity.Name);
throw;
}
Comments
Post a Comment