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 * | 10 * Exception after UrlRequest start. Could be reported by network stack, in |
| 11 * which case netError() will contain native error code. |
11 */ | 12 */ |
12 public class UrlRequestException extends IOException { | 13 public class UrlRequestException extends IOException { |
| 14 /** Net error code if exception is reported by native. */ |
| 15 final int mNetError; |
| 16 |
| 17 UrlRequestException(String message, Throwable cause) { |
| 18 super(message, cause); |
| 19 mNetError = 0; |
| 20 } |
| 21 |
| 22 UrlRequestException(String message, int netError) { |
| 23 super(message, null); |
| 24 mNetError = netError; |
| 25 } |
| 26 |
| 27 /** @return Error code if exception is reported by native. */ |
| 28 public int netError() { |
| 29 return mNetError; |
| 30 } |
13 } | 31 } |
OLD | NEW |