public abstract class

WebResourceErrorCompat

extends java.lang.Object

 java.lang.Object

↳androidx.webkit.WebResourceErrorCompat

Subclasses:

WebResourceErrorImpl

Gradle dependencies

compile group: 'androidx.webkit', name: 'webkit', version: '1.5.0-alpha01'

  • groupId: androidx.webkit
  • artifactId: webkit
  • version: 1.5.0-alpha01

Artifact androidx.webkit:webkit:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.webkit:webkit com.android.support:webkit

Overview

Compatibility version of .

Summary

Constructors
publicWebResourceErrorCompat()

This class cannot be created by applications.

Methods
public abstract java.lang.CharSequencegetDescription()

Gets the string describing the error.

public abstract intgetErrorCode()

Gets the error code of the error.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public WebResourceErrorCompat()

This class cannot be created by applications.

Methods

public abstract int getErrorCode()

Gets the error code of the error. The code corresponds to one of the ERROR_* constants in .

This method should only be called if WebViewFeature.isFeatureSupported(String) returns true for WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE.

Returns:

The error code of the error

public abstract java.lang.CharSequence getDescription()

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

This method should only be called if WebViewFeature.isFeatureSupported(String) returns true for WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION.

Returns:

The description of the error

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.webkit;

import android.webkit.WebResourceError;
import android.webkit.WebViewClient;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresFeature;
import androidx.annotation.RestrictTo;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Compatibility version of {@link WebResourceError}.
 */
public abstract class WebResourceErrorCompat {
    /** @hide */
    @RestrictTo(RestrictTo.Scope.LIBRARY)
    @IntDef(value = {
            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,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface NetErrorCode {}

    /**
     * Gets the error code of the error. The code corresponds to one
     * of the {@code ERROR_*} constants in {@link WebViewClient}.
     *
     * <p>
     * This method should only be called if
     * {@link WebViewFeature#isFeatureSupported(String)}
     * returns true for {@link WebViewFeature#WEB_RESOURCE_ERROR_GET_CODE}.
     *
     * @return The error code of the error
     */
    @RequiresFeature(name = WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    public abstract @NetErrorCode int getErrorCode();

    /**
     * Gets the string describing the error. Descriptions are localized,
     * and thus can be used for communicating the problem to the user.
     *
     * <p>
     * This method should only be called if
     * {@link WebViewFeature#isFeatureSupported(String)}
     * returns true for {@link WebViewFeature#WEB_RESOURCE_ERROR_GET_DESCRIPTION}.
     *
     * @return The description of the error
     */
    @NonNull
    @RequiresFeature(name = WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION,
            enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
    public abstract CharSequence getDescription();

    /**
     * This class cannot be created by applications.
     * @hide
     */
    @RestrictTo(RestrictTo.Scope.LIBRARY)
    public WebResourceErrorCompat() {
    }
}