DescriptionWith this, we make an attempt to convert Java exceptions to Gecko network errors, and I also refactored this a bit.
Wladimir came up with the following mapping in the review:
- ConnectException, NoRouteToHostException, PortUnreachableException => NS_ERROR_CONNECTION_REFUSED
- MalformedURLException, URISyntaxException => NS_ERROR_MALFORMED_URI
- SocketTimeoutException => NS_ERROR_NET_TIMEOUT
- UnknownHostException => NS_ERROR_UNKNOWN_HOST
He also sugggested to add more constants to WebRequest to report SSL errors properly:
- SSLHandshakeException => SSL_ERROR_BAD_SERVER (0x805A2FF9)
- SSLKeyException => SSL_ERROR_WRONG_CERTIFICATE (0x805A2FF5)
- SSLPeerUnverifiedException => SSL_ERROR_BAD_CLIENT (0x805A2FFA)
- SSLProtocolException => SEC_ERROR_BAD_SIGNATURE (0x0x805A1FF6)
I went through the docs of the involved functions and the only mappings I could come up with based on that are those I added in this patch. For instance, HttpUrlConnection.connect() just throws an IOException. Many of the exceptions above derive from IOException, but it's not really documented what we can expect here, so this really needs proper testing of all use cases.
Since we need to get this branch merged, I'd rather not do that now and stick to the known mappings. If you want, I'll create a follow-up issue for this.
Patch Set 1 #
Total comments: 2
Patch Set 2 : Use GetString() and don't return a c_str() to a temporary string object #MessagesTotal messages: 4
|