mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52:50 +08:00
32 lines
666 B
C#
32 lines
666 B
C#
using System;
|
|
using Spectre.Console;
|
|
|
|
namespace Showcase
|
|
{
|
|
public static class ExceptionGenerator
|
|
{
|
|
public static Exception GenerateException()
|
|
{
|
|
try
|
|
{
|
|
SomeOperation();
|
|
throw new InvalidOperationException();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return ex;
|
|
}
|
|
}
|
|
|
|
private static void SomeOperation()
|
|
{
|
|
SomeOperationGoingWrong();
|
|
}
|
|
|
|
private static void SomeOperationGoingWrong()
|
|
{
|
|
throw new InvalidOperationException("Something went very wrong!");
|
|
}
|
|
}
|
|
}
|