mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-30 04:15:49 +08:00
Add demo example
This commit is contained in:
committed by
Phil Scott
parent
36ec3d1fd3
commit
ca036f6543
31
examples/Console/Demo/ExceptionGenerator.cs
Normal file
31
examples/Console/Demo/ExceptionGenerator.cs
Normal 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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user