For this example assume that
session = A working NETunnelProviderSession
I'm using the following code to catch errors from my PacketTunnelProvider
if (! [session startVPNTunnelWithOptions:myOptions andReturnError:&myError]) {
NSLog(@"Error While Starting VPN Tunnel: %@", myError.description);
}
However, that only seems to catch low level errors. I'm trying to figure out how to catch errors in my primary application when I call `[self cancelTunnelWithError:someError];` or the `startTunnelWithOptions` completion handler both inside my PacketTunnelProvider.
I understand that the `startVPNTunnelWithOptions:andReturnError:` function returns immidiately. Since that is the case, how would I go about catching errors in my primary application when they are thrown while canceling the tunnel internally?
Also, I'm not sure if it matters, but my NSError objects always have a custom ErrorDomain and Code.