oden/third-party/vendor/objc_exception/extern/exception.m
2024-03-08 11:03:01 -08:00

21 lines
435 B
Objective-C

#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;
}
}