Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created February 2, 2024 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joe-oli/62ef7bc54ef04ce4d8e6ac8e8c2f77ef to your computer and use it in GitHub Desktop.
Save joe-oli/62ef7bc54ef04ce4d8e6ac8e8c2f77ef to your computer and use it in GitHub Desktop.
Extract All exception messages
catch (Exception ex)
{
tbOutput.Text = GetExceptionMessages(ex);
}
...
private string GetExceptionMessages(Exception ex)
{
var message = ex.Message;
if (ex.InnerException != null)
{
message += Environment.NewLine + "Inner Exception: " + GetExceptionMessages(ex.InnerException);
}
return message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment