| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import java.io.IOException; | 7 import java.io.IOException; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Exception passed to {@link UrlRequest.Callback#onFailed UrlRequest.Callback.o
nFailed()} when: | 10 * Exception passed to {@link UrlRequest.Callback#onFailed UrlRequest.Callback.o
nFailed()} when: |
| 11 * <ul> | 11 * <ul> |
| 12 * <li>{@link UrlRequest.Callback} or {@link UploadDataProvider} method throws a
n exception. In this | 12 * <li>{@link UrlRequest.Callback} or {@link UploadDataProvider} method throws a
n exception. In this |
| 13 * case {@link IOException#getCause getCause()} can be used to find the thro
wn exception. | 13 * case {@link IOException#getCause getCause()} can be used to find the thro
wn exception. |
| 14 * {@link #getErrorCode} will return {@link #ERROR_LISTENER_EXCEPTION_THROWN
}. | 14 * {@link #getErrorCode} will return {@link #ERROR_LISTENER_EXCEPTION_THROWN
}. |
| 15 * <li>Cronet fails to process a network request. In this case | 15 * <li>Cronet fails to process a network request. In this case |
| 16 * {@link #getErrorCode} and {@link #getCronetInternalErrorCode} can be used
to get more | 16 * {@link #getErrorCode} and {@link #getCronetInternalErrorCode} can be used
to get more |
| 17 * information about the specific type of failure. | 17 * information about the specific type of failure. If {@link #getErrorCode} |
| 18 * returns {@link #ERROR_QUIC_PROTOCOL_FAILED}, this exception can be cast t
o a |
| 19 * {@link QuicException} which can provide further details. |
| 18 * </ul> | 20 * </ul> |
| 19 */ | 21 */ |
| 20 public class UrlRequestException extends IOException { | 22 public class UrlRequestException extends IOException { |
| 21 /** | 23 /** |
| 22 * Error code indicating this class wraps an exception thrown by {@link UrlR
equest.Callback} or | 24 * Error code indicating this class wraps an exception thrown by {@link UrlR
equest.Callback} or |
| 23 * {@link UploadDataProvider}. Wrapped exception can be retrieved using | 25 * {@link UploadDataProvider}. Wrapped exception can be retrieved using |
| 24 * {@link IOException#getCause}. | 26 * {@link IOException#getCause}. |
| 25 */ | 27 */ |
| 26 public static final int ERROR_LISTENER_EXCEPTION_THROWN = | 28 public static final int ERROR_LISTENER_EXCEPTION_THROWN = |
| 27 UrlRequestError.LISTENER_EXCEPTION_THROWN; | 29 UrlRequestError.LISTENER_EXCEPTION_THROWN; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 /** | 59 /** |
| 58 * Error code indicating the connection was unexpectedly reset. | 60 * Error code indicating the connection was unexpectedly reset. |
| 59 */ | 61 */ |
| 60 public static final int ERROR_CONNECTION_RESET = UrlRequestError.CONNECTION_
RESET; | 62 public static final int ERROR_CONNECTION_RESET = UrlRequestError.CONNECTION_
RESET; |
| 61 /** | 63 /** |
| 62 * Error code indicating the IP address being contacted is unreachable, mean
ing there is no | 64 * Error code indicating the IP address being contacted is unreachable, mean
ing there is no |
| 63 * route to the specified host or network. | 65 * route to the specified host or network. |
| 64 */ | 66 */ |
| 65 public static final int ERROR_ADDRESS_UNREACHABLE = UrlRequestError.ADDRESS_
UNREACHABLE; | 67 public static final int ERROR_ADDRESS_UNREACHABLE = UrlRequestError.ADDRESS_
UNREACHABLE; |
| 66 /** | 68 /** |
| 69 * Error code indicating an error related to the <a href="https://www.chromi
um.org/quic"> |
| 70 * QUIC</a> protocol. When {@link #getErrorCode} returns this code, this exc
eption can be cast |
| 71 * to {@link QuicException} for more information. |
| 72 */ |
| 73 public static final int ERROR_QUIC_PROTOCOL_FAILED = UrlRequestError.QUIC_PR
OTOCOL_FAILED; |
| 74 /** |
| 67 * Error code indicating another type of error was encountered. | 75 * Error code indicating another type of error was encountered. |
| 68 * {@link #getCronetInternalErrorCode} can be consulted to get a more specif
ic cause. | 76 * {@link #getCronetInternalErrorCode} can be consulted to get a more specif
ic cause. |
| 69 */ | 77 */ |
| 70 public static final int ERROR_OTHER = UrlRequestError.OTHER; | 78 public static final int ERROR_OTHER = UrlRequestError.OTHER; |
| 71 | 79 |
| 72 // Error code, one of ERROR_* | 80 // Error code, one of ERROR_* |
| 73 private final int mErrorCode; | 81 private final int mErrorCode; |
| 74 // Cronet internal error code. | 82 // Cronet internal error code. |
| 75 private final int mCronetInternalErrorCode; | 83 private final int mCronetInternalErrorCode; |
| 76 | 84 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return false; | 156 return false; |
| 149 case ERROR_NETWORK_CHANGED: | 157 case ERROR_NETWORK_CHANGED: |
| 150 case ERROR_TIMED_OUT: | 158 case ERROR_TIMED_OUT: |
| 151 case ERROR_CONNECTION_CLOSED: | 159 case ERROR_CONNECTION_CLOSED: |
| 152 case ERROR_CONNECTION_TIMED_OUT: | 160 case ERROR_CONNECTION_TIMED_OUT: |
| 153 case ERROR_CONNECTION_RESET: | 161 case ERROR_CONNECTION_RESET: |
| 154 return true; | 162 return true; |
| 155 } | 163 } |
| 156 } | 164 } |
| 157 } | 165 } |
| OLD | NEW |