Open davidbuzz opened 1 year ago
there are normally defined in something like Foundation/NSException/NSException.h as something like ... [ this implementation is cut-n-pasted from cocotron , which is opensource on github]
#define NS_DURING \
{ \
NSExceptionFrame __exceptionFrame; \
__NSPushExceptionFrame(&__exceptionFrame); \
if(setjmp(__exceptionFrame.state) == 0) {
#define NS_HANDLER \
__NSPopExceptionFrame(&__exceptionFrame); \
} \
else { \
NSException *localException = __exceptionFrame.exception; \
if(localException) { /* caller does not have to read localException */ \
}
#define NS_ENDHANDLER \
} \
}
#define NS_VALUERETURN(val, type) \
{ \
__NSPopExceptionFrame(&__exceptionFrame); \
return val; \
}
#define NS_VOIDRETURN \
{ \
__NSPopExceptionFrame(&__exceptionFrame); \
return; \
}
... or using the try block equivalent here.. https://github.com/esteve/gnustep-base/blob/9929bacd86e437abf4b6e18557aac3a59768262a/Headers/Foundation/NSException.h#L333
https://developer.apple.com/documentation/foundation/ns_during https://gnustep.github.io/resources/documentation/Developer/Base/ProgrammingManual/manual_6.html
eg: ... NS_DURING [some code]; NS_HANDLER [some other code]; NS_ENDHANDLER ...