mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-07-15 14:04:34 +08:00
34 lines
610 B
C#
34 lines
610 B
C#
using System;
|
|
|
|
namespace CPF.Mac.Foundation
|
|
{
|
|
public class ObjCException : Exception
|
|
{
|
|
private NSException native_exc;
|
|
|
|
public NSException NSException => native_exc;
|
|
|
|
public string Reason => native_exc.Reason;
|
|
|
|
public string Name => native_exc.Name;
|
|
|
|
public override string Message => $"{Name}: {Reason}";
|
|
|
|
public ObjCException()
|
|
{
|
|
native_exc = new NSException("default", string.Empty, null);
|
|
}
|
|
|
|
public ObjCException(NSException exc)
|
|
{
|
|
native_exc = exc;
|
|
}
|
|
|
|
[Preserve]
|
|
internal static void Throw(IntPtr handle)
|
|
{
|
|
throw new ObjCException(new NSException(handle));
|
|
}
|
|
}
|
|
}
|