mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb/WebDriver: Ensure error responses are serialized correctly
This commit is contained in:
parent
4f0d6559f6
commit
79143833b6
Notes:
sideshowbarker
2024-07-16 20:05:14 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/79143833b6 Pull-request: https://github.com/SerenityOS/serenity/pull/24488 Reviewed-by: https://github.com/trflynn89
@ -320,12 +320,15 @@ ErrorOr<void, Client::WrappedError> Client::send_error_response(Error const& err
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Sending error response: {} {}: {}", error.http_status, error.error, error.message);
|
||||
auto reason = HTTP::HttpResponse::reason_phrase_for_code(error.http_status);
|
||||
|
||||
JsonObject result;
|
||||
result.set("error", error.error);
|
||||
result.set("message", error.message);
|
||||
result.set("stacktrace", "");
|
||||
JsonObject error_response;
|
||||
error_response.set("error", error.error);
|
||||
error_response.set("message", error.message);
|
||||
error_response.set("stacktrace", "");
|
||||
if (error.data.has_value())
|
||||
result.set("data", *error.data);
|
||||
error_response.set("data", *error.data);
|
||||
|
||||
JsonObject result;
|
||||
result.set("value", move(error_response));
|
||||
|
||||
StringBuilder content_builder;
|
||||
result.serialize(content_builder);
|
||||
|
Loading…
Reference in New Issue
Block a user