spectre.console/examples/Console/Demo/ExceptionGenerator.cs
2021-04-07 20:32:07 -04:00

32 lines
662 B
C#

using System;
using Spectre.Console;
namespace Demo
{
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!");
}
}
}