Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mozilla/geckodriver.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tolfsen <ato@mozilla.com>2016-10-26 15:36:48 +0300
committerjgraham <james@hoppipolla.co.uk>2016-11-23 10:35:36 +0300
commit7d49dbb8c85ecadb669b2fbeb72b2ff366849085 (patch)
treeb96e18c67ef896924748bbcf32381aca51acc58b /src/marionette.rs
parent3dbe0a93a7ec7525ed6907f853fc6b6af7564a7e (diff)
marionette: improve browser start logging
This change removes the newline character in error messages related to setting preferences and starting the browser process as these tend to make error messages in language bindings look more interesting than they should be. It also avoids calling `Error::description()` as this is implied through the display trait implementation of `Error`. For `PathBuf` we must apparently call `display()` to invoke its `fmt::Display`` trait implementation. The remaining code in `start_browser` is linted with rustfmt.
Diffstat (limited to 'src/marionette.rs')
-rw-r--r--src/marionette.rs28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/marionette.rs b/src/marionette.rs
index 4edb226..08ab05a 100644
--- a/src/marionette.rs
+++ b/src/marionette.rs
@@ -350,11 +350,11 @@ impl MarionetteHandler {
fn start_browser(&mut self, port: u16, mut options: FirefoxOptions) -> WebDriverResult<()> {
let binary = try!(self.binary_path(&mut options)
- .ok_or(WebDriverError::new(ErrorStatus::UnknownError,
- "Expected browser binary location, \
- but unable to find binary in default location, \
- no 'moz:firefoxOptions.binary' capability provided, \
- and no binary flag set on the command line")));
+ .ok_or(WebDriverError::new(ErrorStatus::UnknownError,
+ "Expected browser binary location, but unable to find \
+ binary in default location, no \
+ 'moz:firefoxOptions.binary' capability provided, and \
+ no binary flag set on the command line")));
let custom_profile = options.profile.is_some();
@@ -366,16 +366,18 @@ impl MarionetteHandler {
};
try!(self.set_prefs(port, &mut runner.profile, custom_profile, options.prefs)
- .map_err(|e| WebDriverError::new(ErrorStatus::UnknownError,
- format!("Failed to set preferences:\n{}",
- e.description()))));
+ .map_err(|e| {
+ WebDriverError::new(ErrorStatus::UnknownError,
+ format!("Failed to set preferences: {}", e))
+ }));
- info!("Starting browser {}", binary.to_string_lossy());
+ info!("Starting browser {}", binary.display());
try!(runner.start()
- .map_err(|e| WebDriverError::new(ErrorStatus::UnknownError,
- format!("Failed to start browser:\n{}",
- e.description()))));
-
+ .map_err(|e| {
+ WebDriverError::new(ErrorStatus::UnknownError,
+ format!("Failed to start browser {}: {}",
+ binary.display(), e))
+ }));
self.browser = Some(runner);
Ok(())