Monday, March 11, 2013

Get Exception details recursively

public static string GetExceptionDetailsRecursively(Exception e)
        {
            StringBuilder sb = new StringBuilder();

            while (e != null)
            {
                sb.Append("Inner :");
                sb.Append(e.Message);
                sb.Append("\t");
                e = e.InnerException;
            }

            return sb.ToString();
        }

No comments:

Post a Comment