mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-27 05:32:50 +08:00
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace Spectre.Console.Tests.Data
|
|
{
|
|
public static class TestExceptions
|
|
{
|
|
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "<Pending>")]
|
|
public static bool MethodThatThrows(int? number) => throw new InvalidOperationException("Throwing!");
|
|
|
|
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "<Pending>")]
|
|
public static bool GenericMethodThatThrows<T0, T1, TRet>(int? number) => throw new InvalidOperationException("Throwing!");
|
|
|
|
public static void ThrowWithInnerException()
|
|
{
|
|
try
|
|
{
|
|
MethodThatThrows(null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new InvalidOperationException("Something threw!", ex);
|
|
}
|
|
}
|
|
|
|
public static void ThrowWithGenericInnerException()
|
|
{
|
|
try
|
|
{
|
|
GenericMethodThatThrows<int, float, double>(null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new InvalidOperationException("Something threw!", ex);
|
|
}
|
|
}
|
|
}
|
|
}
|