Skip to content

Instantly share code, notes, and snippets.

@andreastt
Created July 3, 2019 14:17
Show Gist options
  • Save andreastt/7c21b8f94cb1598a29d993d2134f1f15 to your computer and use it in GitHub Desktop.
Save andreastt/7c21b8f94cb1598a29d993d2134f1f15 to your computer and use it in GitHub Desktop.
diff --git a/src/message.rs b/src/message.rs
index aa98505..252a06d 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -125,7 +125,9 @@ impl<'de> Visitor<'de> for MessageVisitor {
let params: Params = match name {
Command::WebDriver(ref cmd) => match cmd {
FindElement => {
- Params::Locator(seq.next_element::<webdriver::Locator>()?.unwrap())
+ let locator = seq.next_element::<webdriver::Locator>()?
+ .ok_or_else(|| de::Error::missing_field("missing parameters!"))?;
+ Params::Locator(locator)
}
GetTimeouts => Params::None,
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment