webdriver: error: add ErrorStatus::InsecureCertificate
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 06 Jan 2017 14:22:54 +0000
changeset 428100 da1221470e137df363646152799b2648a9190f70
parent 428099 57196a6e5fd7118fe036ef6ec6a50895734869fc
child 428101 0a186d0c024f3217e9d50e1b3e82193f6994c635
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
webdriver: error: add ErrorStatus::InsecureCertificate Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 697c8e9de5c4e6f42eff1c0abee01264629e1b3c committer: David Burns <david.burns@theautomatedtester.co.uk>
testing/webdriver/src/error.rs
--- a/testing/webdriver/src/error.rs
+++ b/testing/webdriver/src/error.rs
@@ -7,16 +7,17 @@ use std::convert::From;
 use std::error::Error;
 use std::fmt;
 use std::io::Error as IoError;
 
 #[derive(PartialEq, Debug)]
 pub enum ErrorStatus {
     ElementNotSelectable,
     ElementNotVisible,
+    InsecureCertificate,
     InvalidArgument,
     InvalidCookieDomain,
     InvalidElementCoordinates,
     InvalidElementState,
     InvalidSelector,
     InvalidSessionId,
     JavascriptError,
     MoveTargetOutOfBounds,
@@ -26,26 +27,27 @@ pub enum ErrorStatus {
     NoSuchWindow,
     ScriptTimeout,
     SessionNotCreated,
     StaleElementReference,
     Timeout,
     UnableToSetCookie,
     UnexpectedAlertOpen,
     UnknownError,
+    UnknownMethod,
     UnknownPath,
-    UnknownMethod,
-    UnsupportedOperation
+    UnsupportedOperation,
 }
 
 impl ErrorStatus {
     pub fn status_code(&self) -> &'static str {
         match self {
             &ErrorStatus::ElementNotSelectable => "element not selectable",
             &ErrorStatus::ElementNotVisible => "element not visible",
+            &ErrorStatus::InsecureCertificate => "insecure certificate",
             &ErrorStatus::InvalidArgument => "invalid argument",
             &ErrorStatus::InvalidCookieDomain => "invalid cookie domain",
             &ErrorStatus::InvalidElementCoordinates => "invalid element coordinates",
             &ErrorStatus::InvalidElementState => "invalid element state",
             &ErrorStatus::InvalidSelector => "invalid selector",
             &ErrorStatus::InvalidSessionId => "invalid session id",
             &ErrorStatus::JavascriptError => "javascript error",
             &ErrorStatus::MoveTargetOutOfBounds => "move target out of bounds",
@@ -55,26 +57,27 @@ impl ErrorStatus {
             &ErrorStatus::NoSuchWindow => "no such window",
             &ErrorStatus::ScriptTimeout => "script timeout",
             &ErrorStatus::SessionNotCreated => "session not created",
             &ErrorStatus::StaleElementReference => "stale element reference",
             &ErrorStatus::Timeout => "timeout",
             &ErrorStatus::UnableToSetCookie => "unable to set cookie",
             &ErrorStatus::UnexpectedAlertOpen => "unexpected alert open",
             &ErrorStatus::UnknownError => "unknown error",
+            &ErrorStatus::UnknownMethod => "unknown command",
             &ErrorStatus::UnknownPath => "unknown command",
-            &ErrorStatus::UnknownMethod => "unknown command",
-            &ErrorStatus::UnsupportedOperation => "unsupported operation"
+            &ErrorStatus::UnsupportedOperation => "unsupported operation",
         }
     }
 
     pub fn http_status(&self) -> StatusCode {
         match self {
             &ErrorStatus::ElementNotSelectable => StatusCode::BadRequest,
             &ErrorStatus::ElementNotVisible => StatusCode::BadRequest,
+            &ErrorStatus::InsecureCertificate => StatusCode::BadRequest,
             &ErrorStatus::InvalidArgument => StatusCode::BadRequest,
             &ErrorStatus::InvalidCookieDomain => StatusCode::BadRequest,
             &ErrorStatus::InvalidElementCoordinates => StatusCode::BadRequest,
             &ErrorStatus::InvalidElementState => StatusCode::BadRequest,
             &ErrorStatus::InvalidSelector => StatusCode::BadRequest,
             &ErrorStatus::InvalidSessionId => StatusCode::NotFound,
             &ErrorStatus::JavascriptError => StatusCode::InternalServerError,
             &ErrorStatus::MoveTargetOutOfBounds => StatusCode::InternalServerError,
@@ -84,19 +87,19 @@ impl ErrorStatus {
             &ErrorStatus::NoSuchWindow => StatusCode::BadRequest,
             &ErrorStatus::ScriptTimeout => StatusCode::RequestTimeout,
             &ErrorStatus::SessionNotCreated => StatusCode::InternalServerError,
             &ErrorStatus::StaleElementReference => StatusCode::BadRequest,
             &ErrorStatus::Timeout => StatusCode::RequestTimeout,
             &ErrorStatus::UnableToSetCookie => StatusCode::InternalServerError,
             &ErrorStatus::UnexpectedAlertOpen => StatusCode::InternalServerError,
             &ErrorStatus::UnknownError => StatusCode::InternalServerError,
+            &ErrorStatus::UnknownMethod => StatusCode::MethodNotAllowed,
             &ErrorStatus::UnknownPath => StatusCode::NotFound,
-            &ErrorStatus::UnknownMethod => StatusCode::MethodNotAllowed,
-            &ErrorStatus::UnsupportedOperation => StatusCode::InternalServerError
+            &ErrorStatus::UnsupportedOperation => StatusCode::InternalServerError,
         }
     }
 }
 
 pub type WebDriverResult<T> = Result<T, WebDriverError>;
 
 #[derive(Debug)]
 pub struct WebDriverError {