Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Unified Diff: components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java

Issue 1393713005: [Cronet] Add error code and immediatelyRetryable() to UrlRequestException (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix missing test annotation Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
diff --git a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
index 75c61a53aed25efd9d556b0c312b4bbe5be98f30..ecd55d34d27b877ec62a2a8a40f8ff32a77cac4b 100644
--- a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
@@ -453,8 +453,8 @@ final class CronetUrlRequest implements UrlRequest {
* Only called on the Executor.
*/
private void onListenerException(Exception e) {
- UrlRequestException requestError = new UrlRequestException(
- "CalledByNative method has thrown an exception", e);
+ UrlRequestException requestError =
+ new UrlRequestException("UrlRequestListener method has thrown an exception", e);
Log.e(CronetUrlRequestContext.LOG_TAG,
"Exception in CalledByNative method", e);
// Do not call into listener if request is finished.
@@ -658,20 +658,22 @@ final class CronetUrlRequest implements UrlRequest {
/**
* Called when error has occured, no callbacks will be called afterwards.
*
+ * @param errorCode error code from {@link UrlRequestException.ERROR_LISTENER_EXCEPTION_THROWN
+ * UrlRequestException.ERROR_*}.
* @param nativeError native net error code.
* @param errorString textual representation of the error code.
* @param receivedBytesCount number of bytes received.
*/
@SuppressWarnings("unused")
@CalledByNative
- private void onError(final int nativeError, final String errorString, long receivedBytesCount) {
+ private void onError(
+ int errorCode, int nativeError, String errorString, long receivedBytesCount) {
if (mResponseInfo != null) {
mResponseInfo.setReceivedBytesCount(
mReceivedBytesCountFromRedirects + receivedBytesCount);
}
UrlRequestException requestError = new UrlRequestException(
- "Exception in CronetUrlRequest: " + errorString,
- nativeError);
+ "Exception in CronetUrlRequest: " + errorString, errorCode, nativeError);
failWithException(requestError);
}

Powered by Google App Engine
This is Rietveld 408576698