We're migrating from cordova-plugin-advanced-http to CapacitorHttp. With the Cordova plugin, we could easily detect the "type" of a native error because it contained a known list of error codes (https://github.com/silkimen/cordova-plugin-advanced-http/blob/master/www/error-codes.js). We use this in our app to improve some of the error messages, for example when a site has an invalid certificate. With Cordova, we just need to check if code is SSL_EXCEPTION.
We cannot do the same with CapacitorHttp, because CapacitorHttp just returns the name of the class (Android) or the domain (iOS). So for example in iOS we receive error code NSURLErrorDomain when a certificate is not valid, but this code can also mean other errors not related to certificates.
It would be great to improve the native errors to either return a type/category of the error, similar to what the cordova-plugin-advanced-http does, or return more detailed information so we're able to detect that the error is a certificate error.
I focus in certificate errors because it's our use case, but this can be useful for other types of errors too.
In case it helps, I used different options from https://badssl.com/ to force the certificate errors.