1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:37:46 +00:00

WebDriver: Introduce WebDriver::ErrorCode enum

To avoid having to duplicate error text and http codes over and over,
and potentially make mistakes, let's put them all in one place.
This commit is contained in:
Sam Atkins 2022-10-21 12:51:41 +01:00 committed by Linus Groh
parent 89c3e0b567
commit 9393904073
3 changed files with 96 additions and 0 deletions

View file

@ -11,10 +11,45 @@
namespace WebDriver {
// https://w3c.github.io/webdriver/#dfn-error-code
enum class ErrorCode {
ElementClickIntercepted,
ElementNotInteractable,
InsecureCertificate,
InvalidArgument,
InvalidCookieDomain,
InvalidElementState,
InvalidSelector,
InvalidSessionId,
JavascriptError,
MoveTargetOutOfBounds,
NoSuchAlert,
NoSuchCookie,
NoSuchElement,
NoSuchFrame,
NoSuchWindow,
NoSuchShadowRoot,
ScriptTimeoutError,
SessionNotCreated,
StaleElementReference,
DetachedShadowRoot,
Timeout,
UnableToSetCookie,
UnableToCaptureScreen,
UnexpectedAlertOpen,
UnknownCommand,
UnknownError,
UnknownMethod,
UnsupportedOperation,
};
// https://w3c.github.io/webdriver/#errors
struct WebDriverError {
unsigned http_status;
String error;
String message;
static WebDriverError from_code(ErrorCode, String message);
};
}