1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

WebDriver: Support "data" field in error responses

This commit is contained in:
Linus Groh 2022-11-02 21:56:33 +00:00
parent 747ba2a88f
commit 6e1131e6de
3 changed files with 11 additions and 6 deletions

View file

@ -47,13 +47,14 @@ static Vector<ErrorCodeData> const s_error_code_data = {
{ ErrorCode::UnsupportedOperation, 500, "unsupported operation" },
};
WebDriverError WebDriverError::from_code(ErrorCode code, String message)
WebDriverError WebDriverError::from_code(ErrorCode code, String message, Optional<JsonValue> data)
{
auto& data = s_error_code_data[to_underlying(code)];
auto const& error_code_data = s_error_code_data[to_underlying(code)];
return {
.http_status = data.http_status,
.error = data.json_error_code,
.message = move(message)
.http_status = error_code_data.http_status,
.error = error_code_data.json_error_code,
.message = move(message),
.data = move(data)
};
}