Skip to content

Commit 8bee5f0

Browse files
Merge pull request #9 from genkgo/remove_unwrap
remove unwrap calls
2 parents ace673e + 5721b0b commit 8bee5f0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ pub fn get_module() -> Module {
8585
.argument(Argument::by_val("path"));
8686

8787
watcher.add_method("watch", Visibility::Public, |this, arguments| {
88-
let handler = arguments.get_mut(0).unwrap();
88+
let handler = arguments.get_mut(0)
89+
.ok_or(NotifyError::new("Failed to get mutable handler"))?;
90+
8991
let (tx, rx) = std::sync::mpsc::channel();
9092

91-
let mut watcher = RecommendedWatcher::new(tx, Config::default()).unwrap();
93+
let mut watcher = RecommendedWatcher::new(tx, Config::default())
94+
.map_err(NotifyError::new)?;
9295
let map = this.get_mut_property("map").expect_mut_z_arr()?;
9396

9497
for (k, v) in map.iter() {

0 commit comments

Comments
 (0)