[−][src]Function objc_exception::try
pub unsafe fn try<F, R>(closure: F) -> Result<R, *mut Exception> where
F: FnOnce() -> R, Tries to execute the given closure and catches an Objective-C exception if one is thrown.
Returns a Result that is either Ok if the closure succeeded without an
exception being thrown, or an Err with a pointer to an exception if one
was thrown. The exception is retained and so must be released.
Unsafe because this encourages unwinding through the closure from Objective-C, which is not safe.