# WebResourceErrorCompat

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/WebResourceErrorCompat.java+class:androidx.webkit.WebResourceErrorCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

*** ** * ** ***


```
public abstract class WebResourceErrorCompat
```

<br />

*** ** * ** ***

Compatibility version of `https://developer.android.com/reference/android/webkit/WebResourceError.html`.

## Summary

| ### Public methods |
|---|---|
| `abstract int` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.NAVIGATION_GET_WEB_RESOURCE_ERROR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/WebResourceErrorCompat#getDebugCode()()` Internal error code that may not be stable over time. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/WebResourceErrorCompat#getDescription()()` Gets the string describing the error. |
| `abstract int` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/WebResourceErrorCompat#getErrorCode()()` Gets the error code of the error. |

## Public methods

### getDebugCode

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.16.0)

```
@RequiresFeature(name = WebViewFeature.NAVIGATION_GET_WEB_RESOURCE_ERROR, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
public abstract int getDebugCode()
```

Internal error code that may not be stable over time. Intended purely for debugging purposes.

| Returns |
|---|---|
| `int` | The internal error code |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#NAVIGATION_GET_WEB_RESOURCE_ERROR()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
@RequiresFeature(name = WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
public abstract @NonNull CharSequence getDescription()
```

Gets the string describing the error. Descriptions are localized, and thus can be used for communicating the problem to the user.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html` | The description of the error |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#WEB_RESOURCE_ERROR_GET_DESCRIPTION()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getErrorCode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.1.0)

```
@RequiresFeature(name = WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
public abstract int getErrorCode()
```

Gets the error code of the error. The code corresponds to one of the `ERROR_*` constants in `https://developer.android.com/reference/android/webkit/WebViewClient.html`.

Value is one of the following:

- `WebViewClient.ERROR_UNKNOWN`
- `WebViewClient.ERROR_HOST_LOOKUP`
- `WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME`
- `WebViewClient.ERROR_AUTHENTICATION`
- `WebViewClient.ERROR_PROXY_AUTHENTICATION`
- `WebViewClient.ERROR_CONNECT`
- `WebViewClient.ERROR_IO`
- `WebViewClient.ERROR_TIMEOUT`
- `WebViewClient.ERROR_REDIRECT_LOOP`
- `WebViewClient.ERROR_UNSUPPORTED_SCHEME`
- `WebViewClient.ERROR_FAILED_SSL_HANDSHAKE`
- `WebViewClient.ERROR_BAD_URL`
- `WebViewClient.ERROR_FILE`
- `WebViewClient.ERROR_FILE_NOT_FOUND`
- `WebViewClient.ERROR_TOO_MANY_REQUESTS`
- `WebViewClient.ERROR_UNSAFE_RESOURCE`

<br />

| Returns |
|---|---|
| `int` | The error code of the error |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#WEB_RESOURCE_ERROR_GET_CODE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |