Skip to content

Commit

Permalink
Ensure we log exception text when an exception is given (#77008)
Browse files Browse the repository at this point in the history
The formatter passed doesn't include it (despite that the exception is
passed to it) so we must append it ourselves.
  • Loading branch information
jasonmalinowski authored Feb 4, 2025
2 parents 001d331 + 802890a commit d3d183e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
if (!string.IsNullOrEmpty(categoryName))
message = $"[{categoryName}] {message}";

// The standard formatters don't actually include the exception, so let's include it ourselves
if (exception is not null)
message += Environment.NewLine + exception.ToString();

reporter.Report(new WorkspaceDiagnostic(kind, message));
}
}
Expand Down

0 comments on commit d3d183e

Please sign in to comment.