Skip to content

Commit

Permalink
Properly throw.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Feb 19, 2024
1 parent b8fe9c5 commit 6e32605
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/cscore/StatusValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
12 changes: 1 addition & 11 deletions src/cscore/VideoException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 6e32605

Please sign in to comment.