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

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: Address Helen's comments Created 5 years, 1 month 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 390b88b9ddf42c415e29d17485deba61042dbbfb..d87956b15e22eb667281aaf624d6ba58d2660841 100644
--- a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequest.java
@@ -427,8 +427,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 complete.
@@ -625,20 +625,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_THREW
+ * 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