mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-27 00:08:02 +01:00
Add support for rendering exceptions
This commit is contained in:
committed by
Patrik Svensson
parent
971f9032ba
commit
3c3afe7439
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for <see cref="IAnsiConsole"/>.
|
||||
/// </summary>
|
||||
public static partial class AnsiConsoleExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes an exception to the console.
|
||||
/// </summary>
|
||||
/// <param name="console">The console.</param>
|
||||
/// <param name="exception">The exception to write to the console.</param>
|
||||
/// <param name="format">The exception format options.</param>
|
||||
public static void WriteException(this IAnsiConsole console, Exception exception, ExceptionFormats format = ExceptionFormats.None)
|
||||
{
|
||||
Render(console, exception.GetRenderable(format));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user