Add Logging of Extended Properties of inner exceptions

Topics: Exception Handling Application Block
Apr 29, 2013 at 5:59 PM
Edited Apr 29, 2013 at 5:59 PM
Not sure if it's done in v.6 but one of the missing features EntLib EHAB was not logging of Extended Properties (e.g. data written in Exception.Data collection) in inner applications.

The common scenario:

Business Layer
public void MyMethod(int param1, string param2)
try 
{
...
}
catch (Exception ex)
{
    ex.Data.Add("Call details1", param1);
    ex.Data.Add("Call details2", param2);
    ex.Data.Add("Call details3", some_details);
    throw new BusinessException("Business method failed.", ex);
}
Presentation Layer
try 
{
    BLL.MyMethod(1, "test");
}
catch (Exception ex)
{
    ex.Data.Add("Page", page);
    ex.Data.Add("User-agent", ua);
    ExceptionPolicy.HandleException(ex, "MyPolicy");
}
In this case if "Extended Properties: {dictionary({key} - {value}" defined in the formatter used for exception logging then it will output the Data collection of the root exception only.

It would great if you can change your logic and output Extended Properties of inner exceptions.