I have a function that throws an error, in this function I have a inside a
closure that I need to throw the error from it\'s completion handler. Is that possibl
That's not possible in this case - that completion handler would have to be declared with throws
(and the method with rethrows
) and this one is not.
Note that all that throwing is just a different notations for NSError **
in Objective-C (inout error parameter). The Objective-C callback doesn't have an inout parameter so there is no way to pass the error up.
You will have to use a different method to handle errors.
In general, NSError **
in Obj-C or throws
in Swift don't play well with asynchronous methods because the error handling works synchronously.