11 lines
370 B
C#
11 lines
370 B
C#
using System.Runtime.InteropServices;
|
|||
|
|
|
||
|
|
namespace VoiceCat.Codec;
|
||
|
|
|
||
|
|
public sealed class OpusException : Exception
|
||
|
|
{
|
||
|
|
public int ErrorCode { get; }
|
||
|
|
internal OpusException(int error) : base(Marshal.PtrToStringUTF8(NativeMethods.Error(error))) => ErrorCode = error;
|
||
|
|
internal static int Check(int result) => result < 0 ? throw new OpusException(result) : result;
|
||
|
|
}
|