blob: 700439ecf7d79250a30f28b18567de56509ce18f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <objc/objc.h>
#include <objc/NSObject.h>
void RustObjCExceptionThrow(id exception) {
@throw exception;
}
int RustObjCExceptionTryCatch(void (*try)(void *), void *context, id *error) {
@try {
try(context);
if (error) {
*error = nil;
}
return 0;
} @catch (id exception) {
if (error) {
*error = [exception retain];
}
return 1;
}
}
|