using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Logging
{
///
/// Contains exception methods.
///
public static class ExceptionExtensions
{
///
/// Flattens the exception by digging on InnerException.
///
/// The exception.
///
public static String FlattenException(this Exception exception)
{
var stringBuilder = new StringBuilder();
while (exception != null)
{
stringBuilder.AppendLine(exception.Message);
stringBuilder.AppendLine(exception.StackTrace);
exception = exception.InnerException;
}
return stringBuilder.ToString();
}
}
}