From 6e32605627ab1a0cc1ff458347bd3dabfd96af60 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 19 Feb 2024 14:33:17 -0800 Subject: [PATCH] Properly throw. --- src/cscore/StatusValue.cs | 6 +++++- src/cscore/VideoException.cs | 12 +----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/cscore/StatusValue.cs b/src/cscore/StatusValue.cs index 3f5f5eee..91eb4f49 100644 --- a/src/cscore/StatusValue.cs +++ b/src/cscore/StatusValue.cs @@ -23,6 +23,10 @@ public static class StatusValueExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ThrowIfFailed(this StatusValue status) { - + if (status == StatusValue.Ok) + { + return; + } + VideoException.ThrowException(status); } } diff --git a/src/cscore/VideoException.cs b/src/cscore/VideoException.cs index ca5fbae3..6a817c30 100644 --- a/src/cscore/VideoException.cs +++ b/src/cscore/VideoException.cs @@ -11,18 +11,8 @@ public override string ToString() return $"VideoException [{base.ToString()}]"; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ThrowIfFailed(StatusValue status) - { - if (status == StatusValue.Ok) - { - return; - } - ThrowException(status); - } - [DoesNotReturn] - private static void ThrowException(StatusValue status) + public static void ThrowException(StatusValue status) { throw new VideoException(status.ToString()); }