2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
28 * @brief Describes the Web Error API.
40 /** Creates a type name for @a Ewk_Error. */
41 typedef struct Ewk_Error Ewk_Error;
42 typedef struct Ewk_Error Ewk_Web_Error; // deprecated, please use Ewk_Error
44 /// Creates a type name for Ewk_Error_Type.
47 EWK_ERROR_TYPE_INTERNAL,
48 EWK_ERROR_TYPE_NETWORK,
49 EWK_ERROR_TYPE_POLICY,
50 EWK_ERROR_TYPE_PLUGIN,
51 EWK_ERROR_TYPE_DOWNLOAD,
57 EWK_ERROR_CODE_CANNOTSHOWMIMETYPE = 100,
58 EWK_ERROR_CODE_CANNOTSHOWURL,
59 EWK_ERROR_CODE_FRAMELOADINTERRUPTEDBYPOLICYCHANGE,
60 EWK_ERROR_CODE_CANNOTUSERESTRICTEDPORT,
61 EWK_ERROR_CODE_CANNOTFINDPLUGIN = 200,
62 EWK_ERROR_CODE_CANNOTLOADPLUGIN,
63 EWK_ERROR_CODE_JAVAUNAVAILABLE,
64 EWK_ERROR_CODE_PLUGINCANCELLEDCONNECTION,
65 EWK_ERROR_CODE_PLUGINWILLHANDLELOAD,
69 EWK_ERROR_NETWORK_STATUS_NONE,
71 /* Transport Errors */
72 EWK_ERROR_NETWORK_STATUS_CANCELLED = 1,
73 EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE,
74 EWK_ERROR_NETWORK_STATUS_CANT_RESOLVE_PROXY,
75 EWK_ERROR_NETWORK_STATUS_CANT_CONNECT,
76 EWK_ERROR_NETWORK_STATUS_CANT_CONNECT_PROXY,
77 EWK_ERROR_NETWORK_STATUS_SSL_FAILED,
78 EWK_ERROR_NETWORK_STATUS_IO_ERROR,
79 EWK_ERROR_NETWORK_STATUS_MALFORMED,
80 EWK_ERROR_NETWORK_STATUS_TRY_AGAIN,
81 EWK_ERROR_NETWORK_STATUS_TOO_MANY_REDIRECTS,
82 EWK_ERROR_NETWORK_STATUS_TLS_FAILED,
84 /* HTTP Status Codes */
85 EWK_ERROR_NETWORK_STATUS_CONTINUE = 100,
86 EWK_ERROR_NETWORK_STATUS_SWITCHING_PROTOCOLS,
87 EWK_ERROR_NETWORK_STATUS_PROCESSING,
89 EWK_ERROR_NETWORK_STATUS_OK = 200,
90 EWK_ERROR_NETWORK_STATUS_CREATED,
91 EWK_ERROR_NETWORK_STATUS_ACCEPTED,
92 EWK_ERROR_NETWORK_STATUS_NON_AUTHORITATIVE,
93 EWK_ERROR_NETWORK_STATUS_NO_CONTENT,
94 EWK_ERROR_NETWORK_STATUS_RESET_CONTENT,
95 EWK_ERROR_NETWORK_STATUS_PARTIAL_CONTENT,
96 EWK_ERROR_NETWORK_STATUS_MULTI_STATUS,
98 EWK_ERROR_NETWORK_STATUS_MULTIPLE_CHOICES = 300,
99 EWK_ERROR_NETWORK_STATUS_MOVED_PERMANENTLY,
100 EWK_ERROR_NETWORK_STATUS_FOUND = 302,
101 EWK_ERROR_NETWORK_STATUS_MOVED_TEMPORARILY = 302,
102 EWK_ERROR_NETWORK_STATUS_SEE_OTHER,
103 EWK_ERROR_NETWORK_STATUS_NOT_MODIFIED,
104 EWK_ERROR_NETWORK_STATUS_USE_PROXY,
105 EWK_ERROR_NETWORK_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL,
106 EWK_ERROR_NETWORK_STATUS_TEMPORARY_REDIRECT,
108 EWK_ERROR_NETWORK_STATUS_BAD_REQUEST = 400,
109 EWK_ERROR_NETWORK_STATUS_UNAUTHORIZED,
110 EWK_ERROR_NETWORK_STATUS_PAYMENT_REQUIRED,
111 EWK_ERROR_NETWORK_STATUS_FORBIDDEN,
112 EWK_ERROR_NETWORK_STATUS_NOT_FOUND,
113 EWK_ERROR_NETWORK_STATUS_METHOD_NOT_ALLOWED,
114 EWK_ERROR_NETWORK_STATUS_NOT_ACCEPTABLE,
115 EWK_ERROR_NETWORK_STATUS_PROXY_AUTHENTICATION_REQUIRED,
116 EWK_ERROR_NETWORK_STATUS_PROXY_UNAUTHORIZED = EWK_ERROR_NETWORK_STATUS_PROXY_AUTHENTICATION_REQUIRED,
117 EWK_ERROR_NETWORK_STATUS_REQUEST_TIMEOUT,
118 EWK_ERROR_NETWORK_STATUS_CONFLICT,
119 EWK_ERROR_NETWORK_STATUS_GONE,
120 EWK_ERROR_NETWORK_STATUS_LENGTH_REQUIRED,
121 EWK_ERROR_NETWORK_STATUS_PRECONDITION_FAILED,
122 EWK_ERROR_NETWORK_STATUS_REQUEST_ENTITY_TOO_LARGE,
123 EWK_ERROR_NETWORK_STATUS_REQUEST_URI_TOO_LONG,
124 EWK_ERROR_NETWORK_STATUS_UNSUPPORTED_MEDIA_TYPE,
125 EWK_ERROR_NETWORK_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE,
126 EWK_ERROR_NETWORK_STATUS_INVALID_RANGE = EWK_ERROR_NETWORK_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE,
127 EWK_ERROR_NETWORK_STATUS_EXPECTATION_FAILED,
128 EWK_ERROR_NETWORK_STATUS_UNPROCESSABLE_ENTITY = 422,
129 EWK_ERROR_NETWORK_STATUS_LOCKED,
130 EWK_ERROR_NETWORK_STATUS_FAILED_DEPENDENCY,
132 EWK_ERROR_NETWORK_STATUS_INTERNAL_SERVER_ERROR = 500,
133 EWK_ERROR_NETWORK_STATUS_NOT_IMPLEMENTED,
134 EWK_ERROR_NETWORK_STATUS_BAD_GATEWAY,
135 EWK_ERROR_NETWORK_STATUS_SERVICE_UNAVAILABLE,
136 EWK_ERROR_NETWORK_STATUS_GATEWAY_TIMEOUT,
137 EWK_ERROR_NETWORK_STATUS_HTTP_VERSION_NOT_SUPPORTED,
138 EWK_ERROR_NETWORK_STATUS_INSUFFICIENT_STORAGE = 507,
139 EWK_ERROR_NETWORK_STATUS_NOT_EXTENDED = 510
140 } Ewk_Error_Network_Status;
143 EWK_ERROR_IO_CODE_FAILED,
144 EWK_ERROR_IO_CODE_NOT_FOUND,
145 EWK_ERROR_IO_CODE_EXISTS,
146 EWK_ERROR_IO_CODE_IS_DIRECTORY,
147 EWK_ERROR_IO_CODE_NOT_DIRECTORY,
148 EWK_ERROR_IO_CODE_NOT_EMPTY,
149 EWK_ERROR_IO_CODE_NOT_REGULAR_FILE,
150 EWK_ERROR_IO_CODE_NOT_SYMBOLIC_LINK,
151 EWK_ERROR_IO_CODE_NOT_MOUNTABLE_FILE,
152 EWK_ERROR_IO_CODE_FILENAME_TOO_LONG,
153 EWK_ERROR_IO_CODE_INVALID_FILENAME,
154 EWK_ERROR_IO_CODE_TOO_MANY_LINKS,
155 EWK_ERROR_IO_CODE_NO_SPACE,
156 EWK_ERROR_IO_CODE_INVALID_ARGUMENT,
157 EWK_ERROR_IO_CODE_PERMISSION_DENIED,
158 EWK_ERROR_IO_CODE_NOT_SUPPORTED,
159 EWK_ERROR_IO_CODE_NOT_MOUNTED,
160 EWK_ERROR_IO_CODE_ALREADY_MOUNTED,
161 EWK_ERROR_IO_CODE_CLOSED,
162 EWK_ERROR_IO_CODE_CANCELLED,
163 EWK_ERROR_IO_CODE_PENDING,
164 EWK_ERROR_IO_CODE_READ_ONLY,
165 EWK_ERROR_IO_CODE_CANT_CREATE_BACKUP,
166 EWK_ERROR_IO_CODE_WRONG_ETAG,
167 EWK_ERROR_IO_CODE_TIMED_OUT,
168 EWK_ERROR_IO_CODE_WOULD_RECURSE,
169 EWK_ERROR_IO_CODE_BUSY,
170 EWK_ERROR_IO_CODE_WOULD_BLOCK,
171 EWK_ERROR_IO_CODE_HOST_NOT_FOUND,
172 EWK_ERROR_IO_CODE_WOULD_MERGE,
173 EWK_ERROR_IO_CODE_FAILED_HANDLED,
174 EWK_ERROR_IO_CODE_TOO_MANY_OPEN_FILES,
175 EWK_ERROR_IO_CODE_NOT_INITIALIZED,
176 EWK_ERROR_IO_CODE_ADDRESS_IN_USE,
177 EWK_ERROR_IO_CODE_PARTIAL_INPUT,
178 EWK_ERROR_IO_CODE_INVALID_DATA,
179 EWK_ERROR_IO_CODE_DBUS_ERROR,
180 EWK_ERROR_IO_CODE_HOST_UNREACHABLE,
181 EWK_ERROR_IO_CODE_NETWORK_UNREACHABLE,
182 EWK_ERROR_IO_CODE_CONNECTION_REFUSED,
183 EWK_ERROR_IO_CODE_PROXY_FAILED,
184 EWK_ERROR_IO_CODE_PROXY_AUTH_FAILED,
185 EWK_ERROR_IO_CODE_PROXY_NEED_AUTH,
186 EWK_ERROR_IO_CODE_PROXY_NOT_ALLOWED
191 * Query type for this error.
193 * @param error error object to query.
195 * @return the error type, that may be @c NULL. This pointer is
196 * guaranteed to be eina_stringshare, so whenever possible
197 * save yourself some cpu cycles and use
198 * eina_stringshare_ref() instead of eina_stringshare_add() or
201 EAPI Ewk_Error_Type ewk_error_type_get(const Ewk_Error *error);
204 * Query failing URL for this error.
206 * URL that failed loading.
208 * @param error error object to query.
210 * @return the URL pointer, that may be @c NULL. This pointer is
211 * guaranteed to be eina_stringshare, so whenever possible
212 * save yourself some cpu cycles and use
213 * eina_stringshare_ref() instead of eina_stringshare_add() or
216 EAPI const char *ewk_error_url_get(const Ewk_Error *error);
219 * Query HTTP error code.
221 * @param error error object to query.
224 * @note If ewk_error_domain_get returns "WebKitErrorDomain", the error code represents Ewk_Error_Code.
225 * If "soup_http_error_quark", it represents Ewk_Error_Network_Status.
226 * If "g-io-error-quark", it represents Ewk_Error_Io_Code.
229 * @return the HTTP error code.
231 EAPI int ewk_error_code_get(const Ewk_Error *error);
234 * Query description for this error.
236 * @param error error object to query.
238 * @return the description pointer, that may be @c NULL. This pointer is
239 * guaranteed to be eina_stringshare, so whenever possible
240 * save yourself some cpu cycles and use
241 * eina_stringshare_ref() instead of eina_stringshare_add() or
244 EAPI const char *ewk_error_description_get(const Ewk_Error *error);
247 * Query if error should be treated as a cancellation.
249 * @param error error object to query.
251 * @return @c EINA_TRUE if this error should be treated as a cancellation, @c EINA_FALSE otherwise
253 EAPI Eina_Bool ewk_error_cancellation_get(const Ewk_Error *error);
257 * Returns domain from Ewk_Error.
259 * @param error Ewk_Error object received from "load,error" evas object smart callback
261 * @return @c domain string on success or empty string on failure
263 EAPI const char* ewk_error_domain_get(const Ewk_Error* error);
270 #endif // ewk_error_h