Skip to content

Commit

Permalink
remove unwrap calls
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Jun 11, 2024
1 parent ace673e commit 5721b0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ pub fn get_module() -> Module {
.argument(Argument::by_val("path"));

watcher.add_method("watch", Visibility::Public, |this, arguments| {
let handler = arguments.get_mut(0).unwrap();
let handler = arguments.get_mut(0)
.ok_or(NotifyError::new("Failed to get mutable handler"))?;

let (tx, rx) = std::sync::mpsc::channel();

let mut watcher = RecommendedWatcher::new(tx, Config::default()).unwrap();
let mut watcher = RecommendedWatcher::new(tx, Config::default())
.map_err(NotifyError::new)?;
let map = this.get_mut_property("map").expect_mut_z_arr()?;

for (k, v) in map.iter() {
Expand Down

0 comments on commit 5721b0b

Please sign in to comment.