/// <summary>
/// Gets the related exception logs
/// </summary>
/// <param name="baseException">The base exception.</param>
/// <returns>List of Exception Detail Summary objects</returns>
private List<ExceptionLog> GetExceptionLogs( ExceptionLog baseException )
{
List<ExceptionLog> exceptionList = new List<ExceptionLog>();
ExceptionLogService svc = new ExceptionLogService( new RockContext() );
//load the base exception
exceptionList.Add( baseException );
//get the parentID
int? parentId = baseException.ParentId;
//loop through exception hierarchy (parent, grandparent, etc)
while ( parentId != null && parentId > 0 )
{
var exception = svc.Get( (int)parentId );
if ( exception != null )
{
exceptionList.Add( exception );
}
parentId = exception.ParentId;
}
//get inner exceptions
if ( baseException.HasInnerException != null && (bool)baseException.HasInnerException )
{
exceptionList.AddRange( svc.GetByParentId( baseException.Id ) );
}
return exceptionList;
}