Bug 1368083 - Better bindgen error message when files are missing. r=emilio draft
authorRalph Giles <giles@mozilla.com>
Thu, 06 Jul 2017 09:09:09 -0700
changeset 605593 75f84cdad3a88defe422f8e9412abd65e26beb41
parent 605591 3e1c28cb5ea674f7429c98dbaf915c33b2089de7
child 636539 ab225f64e787ea3ed7e76514c36dff8360c597b9
push id67459
push userbmo:giles@thaumas.net
push dateSat, 08 Jul 2017 01:33:04 +0000
reviewersemilio
bugs1368083
milestone56.0a1
Bug 1368083 - Better bindgen error message when files are missing. r=emilio This is only slightly more informative because it doesn't give the filename, but I think it's an improvement on the simple unwrap() panic when we try to read a file which isn't there. MozReview-Commit-ID: HseYZ48TUrF
servo/components/style/build_gecko.rs
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -128,17 +128,18 @@ mod bindings {
                        .expect("Failed to get modified time of executable"));
     }
 
     fn get_modified_time(file: &Path) -> Option<SystemTime> {
         file.metadata().and_then(|m| m.modified()).ok()
     }
 
     fn update_last_modified(file: &Path) {
-        let modified = get_modified_time(file).unwrap();
+        let modified = get_modified_time(file)
+            .expect("Couldn't get file modification time");
         let mut last_modified = LAST_MODIFIED.lock().unwrap();
         *last_modified = cmp::max(modified, *last_modified);
     }
 
     fn search_include(name: &str) -> Option<PathBuf> {
         for path in SEARCH_PATHS.iter() {
             let file = path.join(name);
             if file.is_file() {