using System; namespace Brutal.FmodApi; /// /// An exception thrown by a failed result assertion /// public class FmodResultException : Exception { /// /// Creates an exception for a failed result assertion /// /// The message that describes the failed result public FmodResultException(string? message) : base(message) { } } /// /// An extension library for the Result enum /// public static partial class ResultExtensions { /// /// Throws an exception if the Result does not equal Result.Ok /// /// The result code to check /// public static void Check(this Result result) { if (result != Result.Ok) { throw new FmodResultException($"{result.ToString()}: { result.GetErrorString()}"); } } }