Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 5668574207148032: Handle network errors better (Closed)

Created:
Nov. 22, 2013, 4:15 p.m. by Felix Dahlke
Modified:
Nov. 22, 2013, 6:05 p.m.
Visibility:
Public.

Description

With 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -38 lines) Patch
M jni/AndroidWebRequest.cpp View 1 11 chunks +70 lines, -38 lines 0 comments Download

Messages

Total messages: 4
Felix Dahlke
Nov. 22, 2013, 4:23 p.m. (2013-11-22 16:23:01 UTC) #1
Wladimir Palant
LGTM with the issue below addressed. http://codereview.adblockplus.org/5668574207148032/diff/5629499534213120/jni/AndroidWebRequest.cpp File jni/AndroidWebRequest.cpp (right): http://codereview.adblockplus.org/5668574207148032/diff/5629499534213120/jni/AndroidWebRequest.cpp#newcode52 jni/AndroidWebRequest.cpp:52: return ("Java Exception: ...
Nov. 22, 2013, 5:51 p.m. (2013-11-22 17:51:03 UTC) #2
Felix Dahlke
Addressed the issue, also used GetString() for the JNI string conversion. http://codereview.adblockplus.org/5668574207148032/diff/5629499534213120/jni/AndroidWebRequest.cpp File jni/AndroidWebRequest.cpp (right): ...
Nov. 22, 2013, 6:01 p.m. (2013-11-22 18:01:12 UTC) #3
Wladimir Palant
Nov. 22, 2013, 6:04 p.m. (2013-11-22 18:04:34 UTC) #4
LGTM

Powered by Google App Engine
This is Rietveld