mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
WebDriver: Rename HttpError -> WebDriverError
This commit is contained in:
parent
87a9462b7f
commit
89c3e0b567
7 changed files with 220 additions and 219 deletions
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <WebDriver/HttpError.h>
|
||||
#include <WebDriver/TimeoutsConfiguration.h>
|
||||
#include <WebDriver/WebDriverError.h>
|
||||
|
||||
namespace WebDriver {
|
||||
|
||||
|
@ -35,7 +35,7 @@ JsonObject timeouts_object(TimeoutsConfiguration const& timeouts)
|
|||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#ref-for-dfn-json-deserialize-3
|
||||
ErrorOr<TimeoutsConfiguration, HttpError> json_deserialize_as_a_timeouts_configuration(JsonValue const& value)
|
||||
ErrorOr<TimeoutsConfiguration, WebDriverError> json_deserialize_as_a_timeouts_configuration(JsonValue const& value)
|
||||
{
|
||||
constexpr i64 max_safe_integer = 9007199254740991;
|
||||
|
||||
|
@ -44,7 +44,7 @@ ErrorOr<TimeoutsConfiguration, HttpError> json_deserialize_as_a_timeouts_configu
|
|||
|
||||
// 2. If value is not a JSON Object, return error with error code invalid argument.
|
||||
if (!value.is_object())
|
||||
return HttpError { 400, "invalid argument", "Payload is not a JSON object" };
|
||||
return WebDriverError { 400, "invalid argument", "Payload is not a JSON object" };
|
||||
|
||||
// 3. If value has a property with the key "script":
|
||||
if (value.as_object().has("script"sv)) {
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<TimeoutsConfiguration, HttpError> json_deserialize_as_a_timeouts_configu
|
|||
|
||||
// 2. If script duration is a number and less than 0 or greater than maximum safe integer, or it is not null, return error with error code invalid argument.
|
||||
if ((script_duration.is_number() && (script_duration.to_i64() < 0 || script_duration.to_i64() > max_safe_integer)) || !script_duration.is_null())
|
||||
return HttpError { 400, "invalid argument", "Invalid script duration" };
|
||||
return WebDriverError { 400, "invalid argument", "Invalid script duration" };
|
||||
|
||||
// 3. Set timeouts’s script timeout to script duration.
|
||||
timeouts.script_timeout = script_duration.is_null() ? Optional<u64> {} : script_duration.to_u64();
|
||||
|
@ -66,7 +66,7 @@ ErrorOr<TimeoutsConfiguration, HttpError> json_deserialize_as_a_timeouts_configu
|
|||
|
||||
// 2. If page load duration is less than 0 or greater than maximum safe integer, return error with error code invalid argument.
|
||||
if (!page_load_duration.is_number() || page_load_duration.to_i64() < 0 || page_load_duration.to_i64() > max_safe_integer)
|
||||
return HttpError { 400, "invalid argument", "Invalid page load duration" };
|
||||
return WebDriverError { 400, "invalid argument", "Invalid page load duration" };
|
||||
|
||||
// 3. Set timeouts’s page load timeout to page load duration.
|
||||
timeouts.page_load_timeout = page_load_duration.to_u64();
|
||||
|
@ -79,7 +79,7 @@ ErrorOr<TimeoutsConfiguration, HttpError> json_deserialize_as_a_timeouts_configu
|
|||
|
||||
// 2. If implicit duration is less than 0 or greater than maximum safe integer, return error with error code invalid argument.
|
||||
if (!implicit_duration.is_number() || implicit_duration.to_i64() < 0 || implicit_duration.to_i64() > max_safe_integer)
|
||||
return HttpError { 400, "invalid argument", "Invalid implicit duration" };
|
||||
return WebDriverError { 400, "invalid argument", "Invalid implicit duration" };
|
||||
|
||||
// 3. Set timeouts’s implicit wait timeout to implicit duration.
|
||||
timeouts.implicit_wait_timeout = implicit_duration.to_u64();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue