mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibWeb+WebContent+WebDriver: Port WebDriver to String
This commit is contained in:
parent
bc54c0cdfb
commit
9879ac0893
Notes:
github-actions[bot]
2025-02-21 00:29:12 +00:00
Author: https://github.com/trflynn89
Commit: 9879ac0893
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3631
Reviewed-by: https://github.com/awesomekling ✅
21 changed files with 194 additions and 190 deletions
|
@ -7,8 +7,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace Web::WebDriver {
|
||||
|
||||
|
@ -50,13 +50,14 @@ enum class ErrorCode {
|
|||
// https://w3c.github.io/webdriver/#errors
|
||||
struct Error {
|
||||
unsigned http_status;
|
||||
ByteString error;
|
||||
ByteString message;
|
||||
String error;
|
||||
String message;
|
||||
Optional<JsonValue> data;
|
||||
|
||||
static Error from_code(ErrorCode, ByteString message, Optional<JsonValue> data = {});
|
||||
static Error from_code(ErrorCode, String message, Optional<JsonValue> data = {});
|
||||
static Error from_code(ErrorCode, StringView message, Optional<JsonValue> data = {});
|
||||
|
||||
Error(unsigned http_status, ByteString error, ByteString message, Optional<JsonValue> data);
|
||||
Error(unsigned http_status, String error, String message, Optional<JsonValue> data);
|
||||
Error(AK::Error const&);
|
||||
};
|
||||
|
||||
|
@ -66,6 +67,6 @@ template<>
|
|||
struct AK::Formatter<Web::WebDriver::Error> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, Web::WebDriver::Error const& error)
|
||||
{
|
||||
return Formatter<StringView>::format(builder, ByteString::formatted("Error {}, {}: {}", error.http_status, error.error, error.message));
|
||||
return Formatter<StringView>::format(builder, MUST(String::formatted("Error {}, {}: {}", error.http_status, error.error, error.message)));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue