Skip to content

Instantly share code, notes, and snippets.

@gowon
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save gowon/6e9f6b2dd7fd87ba4873 to your computer and use it in GitHub Desktop.

Select an option

Save gowon/6e9f6b2dd7fd87ba4873 to your computer and use it in GitHub Desktop.
Grabbing all exception messages from inner exceptions
using System;
using System.Text;
public static class ExceptionExtensions
{
public static string GetAllMessages(this Exception ex)
{
var message = new StringBuilder();
for (var e = ex; e != null; e = e.InnerException)
message.AppendLine(e.Message);
return message.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment