WebResourceError.java revision 8d4f07f8d377fc1888879d3ef84c084d3bc5fb5d
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.webkit;
18
19import android.annotation.SystemApi;
20
21/**
22 * Encapsulates information about errors occured during loading of web resources. See
23 * {@link WebViewClient#onReceivedError(WebView, WebResourceRequest, WebResourceError) WebViewClient.onReceivedError(WebView, WebResourceRequest, WebResourceError)}
24 */
25public abstract class WebResourceError {
26    /**
27     * Gets the error code of the error. The code corresponds to one
28     * of the ERROR_* constants in {@link WebViewClient}.
29     *
30     * @return The error code of the error
31     */
32    public abstract int getErrorCode();
33
34    /**
35     * Gets the string describing the error. Descriptions are localized,
36     * and thus can be used for communicating the problem to the user.
37     *
38     * @return The description of the error
39     */
40    public abstract CharSequence getDescription();
41
42    /**
43     * This class can not be subclassed by applications.
44     * @hide
45     */
46    @SystemApi
47    public WebResourceError() {}
48}
49