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

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/UrlRequestException.java

Issue 2339223002: Cronet API Refactoring (Closed)
Patch Set: Rebase & Conflict Resolution Created 4 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 unified diff | Download patch
OLDNEW
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. If {@link #getErrorCode} 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 18 * returns {@link #ERROR_QUIC_PROTOCOL_FAILED}, this exception can be cast t o a
19 * {@link QuicException} which can provide further details. 19 * {@link QuicException} which can provide further details.
20 * </ul> 20 * </ul>
21 */ 21 */
22 public class UrlRequestException extends IOException { 22 public class UrlRequestException extends IOException {
23 /** 23 /**
24 * 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
25 * {@link UploadDataProvider}. Wrapped exception can be retrieved using 25 * {@link UploadDataProvider}. Wrapped exception can be retrieved using
26 * {@link IOException#getCause}. 26 * {@link IOException#getCause}.
27 */ 27 */
28 public static final int ERROR_LISTENER_EXCEPTION_THROWN = 28 public static final int ERROR_LISTENER_EXCEPTION_THROWN = 0;
29 UrlRequestError.LISTENER_EXCEPTION_THROWN;
30 /** 29 /**
31 * Error code indicating the host being sent the request could not be resolv ed to an IP address. 30 * Error code indicating the host being sent the request could not be resolv ed to an IP address.
32 */ 31 */
33 public static final int ERROR_HOSTNAME_NOT_RESOLVED = UrlRequestError.HOSTNA ME_NOT_RESOLVED; 32 public static final int ERROR_HOSTNAME_NOT_RESOLVED = 1;
34 /** 33 /**
35 * Error code indicating the device was not connected to any network. 34 * Error code indicating the device was not connected to any network.
36 */ 35 */
37 public static final int ERROR_INTERNET_DISCONNECTED = UrlRequestError.INTERN ET_DISCONNECTED; 36 public static final int ERROR_INTERNET_DISCONNECTED = 2;
38 /** 37 /**
39 * Error code indicating that as the request was processed the network confi guration changed. 38 * Error code indicating that as the request was processed the network confi guration changed.
40 */ 39 */
41 public static final int ERROR_NETWORK_CHANGED = UrlRequestError.NETWORK_CHAN GED; 40 public static final int ERROR_NETWORK_CHANGED = 3;
42 /** 41 /**
43 * Error code indicating a timeout expired. Timeouts expiring while attempti ng to connect will 42 * Error code indicating a timeout expired. Timeouts expiring while attempti ng to connect will
44 * be reported as the more specific {@link #ERROR_CONNECTION_TIMED_OUT}. 43 * be reported as the more specific {@link #ERROR_CONNECTION_TIMED_OUT}.
45 */ 44 */
46 public static final int ERROR_TIMED_OUT = UrlRequestError.TIMED_OUT; 45 public static final int ERROR_TIMED_OUT = 4;
47 /** 46 /**
48 * Error code indicating the connection was closed unexpectedly. 47 * Error code indicating the connection was closed unexpectedly.
49 */ 48 */
50 public static final int ERROR_CONNECTION_CLOSED = UrlRequestError.CONNECTION _CLOSED; 49 public static final int ERROR_CONNECTION_CLOSED = 5;
51 /** 50 /**
52 * Error code indicating the connection attempt timed out. 51 * Error code indicating the connection attempt timed out.
53 */ 52 */
54 public static final int ERROR_CONNECTION_TIMED_OUT = UrlRequestError.CONNECT ION_TIMED_OUT; 53 public static final int ERROR_CONNECTION_TIMED_OUT = 6;
55 /** 54 /**
56 * Error code indicating the connection attempt was refused. 55 * Error code indicating the connection attempt was refused.
57 */ 56 */
58 public static final int ERROR_CONNECTION_REFUSED = UrlRequestError.CONNECTIO N_REFUSED; 57 public static final int ERROR_CONNECTION_REFUSED = 7;
59 /** 58 /**
60 * Error code indicating the connection was unexpectedly reset. 59 * Error code indicating the connection was unexpectedly reset.
61 */ 60 */
62 public static final int ERROR_CONNECTION_RESET = UrlRequestError.CONNECTION_ RESET; 61 public static final int ERROR_CONNECTION_RESET = 8;
63 /** 62 /**
64 * Error code indicating the IP address being contacted is unreachable, mean ing there is no 63 * Error code indicating the IP address being contacted is unreachable, mean ing there is no
65 * route to the specified host or network. 64 * route to the specified host or network.
66 */ 65 */
67 public static final int ERROR_ADDRESS_UNREACHABLE = UrlRequestError.ADDRESS_ UNREACHABLE; 66 public static final int ERROR_ADDRESS_UNREACHABLE = 9;
68 /** 67 /**
69 * Error code indicating an error related to the <a href="https://www.chromi um.org/quic"> 68 * 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 69 * QUIC</a> protocol. When {@link #getErrorCode} returns this code, this exc eption can be cast
71 * to {@link QuicException} for more information. 70 * to {@link QuicException} for more information.
72 */ 71 */
73 public static final int ERROR_QUIC_PROTOCOL_FAILED = UrlRequestError.QUIC_PR OTOCOL_FAILED; 72 public static final int ERROR_QUIC_PROTOCOL_FAILED = 10;
74 /** 73 /**
75 * Error code indicating another type of error was encountered. 74 * Error code indicating another type of error was encountered.
76 * {@link #getCronetInternalErrorCode} can be consulted to get a more specif ic cause. 75 * {@link #getCronetInternalErrorCode} can be consulted to get a more specif ic cause.
77 */ 76 */
78 public static final int ERROR_OTHER = UrlRequestError.OTHER; 77 public static final int ERROR_OTHER = 11;
79 78
80 // Error code, one of ERROR_* 79 // Error code, one of ERROR_*
81 private final int mErrorCode; 80 private final int mErrorCode;
82 // Cronet internal error code. 81 // Cronet internal error code.
83 private final int mCronetInternalErrorCode; 82 private final int mCronetInternalErrorCode;
84 83
85 /** 84 /**
86 * Constructs an exception with a specific error. 85 * Constructs an exception with a specific error.
87 * 86 *
88 * @param message explanation of failure. 87 * @param message explanation of failure.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return false; 155 return false;
157 case ERROR_NETWORK_CHANGED: 156 case ERROR_NETWORK_CHANGED:
158 case ERROR_TIMED_OUT: 157 case ERROR_TIMED_OUT:
159 case ERROR_CONNECTION_CLOSED: 158 case ERROR_CONNECTION_CLOSED:
160 case ERROR_CONNECTION_TIMED_OUT: 159 case ERROR_CONNECTION_TIMED_OUT:
161 case ERROR_CONNECTION_RESET: 160 case ERROR_CONNECTION_RESET:
162 return true; 161 return true;
163 } 162 }
164 } 163 }
165 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698