In our React Native app we use TrustKit for certificate pinning on iOS. If the certificate validation fails and I catch the error within the JavaScript context (example below), logging the error only shows a generic error message: TypeError: Network request failed.
Since the error doesn't stem from an http status code, like 404, I believe I need to inspect the NSURLErrorDomain code (for example) so that I can map it with the correct error handling. Are there any APIs in React Native, fetch, axios, or another package that would provide access to these error details?
fetch(myURL).then(() => true, (error) => {
console.log(error) //TypeError: Network request failed
return false;
})