1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibWeb: Allow constructing a WebDriver::Error from an OOM AK::Error

This will allow easily surrounding operations that may fail due to OOM
with TRY. Note that we now also have to define a "normal" constructor
for WebDriver::Error in order to add the AK::Error constructor.
This commit is contained in:
Timothy Flynn 2023-03-05 15:26:51 -05:00 committed by Linus Groh
parent a7bb72a3d6
commit 03d0be13e8
2 changed files with 27 additions and 4 deletions

View file

@ -42,6 +42,9 @@ enum class ErrorCode {
UnknownError,
UnknownMethod,
UnsupportedOperation,
// Non-standard error codes:
OutOfMemory,
};
// https://w3c.github.io/webdriver/#errors
@ -52,6 +55,9 @@ struct Error {
Optional<JsonValue> data;
static Error from_code(ErrorCode, DeprecatedString message, Optional<JsonValue> data = {});
Error(unsigned http_status, DeprecatedString error, DeprecatedString message, Optional<JsonValue> data);
Error(AK::Error const&);
};
}