Add demo example

This commit is contained in:
Patrik Svensson
2021-03-08 19:36:04 +01:00
committed by Phil Scott
parent 36ec3d1fd3
commit ca036f6543
6 changed files with 340 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
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!");
}
}
}