mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-29 17:28:06 +01:00
Use file scoped namespace declarations
This commit is contained in:
committed by
Phil Scott
parent
1dbaf50935
commit
ec1188b837
@@ -1,51 +1,50 @@
|
||||
using System;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Spectre.Console
|
||||
namespace Spectre.Console;
|
||||
|
||||
/// <summary>
|
||||
/// Contains extension methods for <see cref="Exception"/>.
|
||||
/// </summary>
|
||||
public static class ExceptionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for <see cref="Exception"/>.
|
||||
/// Gets a <see cref="IRenderable"/> representation of the exception.
|
||||
/// </summary>
|
||||
public static class ExceptionExtensions
|
||||
/// <param name="exception">The exception to format.</param>
|
||||
/// <param name="format">The exception format options.</param>
|
||||
/// <returns>A <see cref="IRenderable"/> representing the exception.</returns>
|
||||
public static IRenderable GetRenderable(this Exception exception, ExceptionFormats format = ExceptionFormats.Default)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IRenderable"/> representation of the exception.
|
||||
/// </summary>
|
||||
/// <param name="exception">The exception to format.</param>
|
||||
/// <param name="format">The exception format options.</param>
|
||||
/// <returns>A <see cref="IRenderable"/> representing the exception.</returns>
|
||||
public static IRenderable GetRenderable(this Exception exception, ExceptionFormats format = ExceptionFormats.Default)
|
||||
if (exception is null)
|
||||
{
|
||||
if (exception is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
return GetRenderable(exception, new ExceptionSettings
|
||||
{
|
||||
Format = format,
|
||||
});
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IRenderable"/> representation of the exception.
|
||||
/// </summary>
|
||||
/// <param name="exception">The exception to format.</param>
|
||||
/// <param name="settings">The exception settings.</param>
|
||||
/// <returns>A <see cref="IRenderable"/> representing the exception.</returns>
|
||||
public static IRenderable GetRenderable(this Exception exception, ExceptionSettings settings)
|
||||
return GetRenderable(exception, new ExceptionSettings
|
||||
{
|
||||
if (exception is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
if (settings is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
return ExceptionFormatter.Format(exception, settings);
|
||||
}
|
||||
Format = format,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="IRenderable"/> representation of the exception.
|
||||
/// </summary>
|
||||
/// <param name="exception">The exception to format.</param>
|
||||
/// <param name="settings">The exception settings.</param>
|
||||
/// <returns>A <see cref="IRenderable"/> representing the exception.</returns>
|
||||
public static IRenderable GetRenderable(this Exception exception, ExceptionSettings settings)
|
||||
{
|
||||
if (exception is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
|
||||
if (settings is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
return ExceptionFormatter.Format(exception, settings);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user