AFAIK there’s no API to get this level of detail about connection errors. I can understand why your app might want to gather such info. I recommend you file an enhancement request explaining the features you’d like t see and why you’d like to see them. Please post your bug number, just for the record.
In the meantime, if you’re having users with specific problems you can get diagnostic information from them using the techniques described on the Profiles and Logs page. A vanilla sysdiagnose will contain some useful info but if that’s not sufficient you can have the user follow the VPN (Network Extension) instructions for their platform.
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"