I've noticed that if a call to startVPNTunnel() is made while no network interface is active on the system, the call "succeeds" (i.e., doesn't throw), but the VPN connection state goes straight from NEVPNStatus.disconnecting to NEVPNStatus.disconnected.
The docs for startVPNTunnel() state:
In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure.
Additionally, there is an NEVPNConnectionError enum that contains a noNetworkAvailable case. However, this isn't thrown in this case, when startVPNTunnel() is called.
I just wanted to ask under what circumstances startVPNTunnel() does throw, and should this be one of them?
Additionally, to catch such errors, would it be better to call fetchLastDisconnectError() in the .NEVPNStatusDidChange handler?