diff options
| author | Scott Lawrence <scott+git@ineffectivetheory.com> | 2024-11-28 02:59:41 -0700 |
|---|---|---|
| committer | Scott Lawrence <scott+git@ineffectivetheory.com> | 2024-11-28 02:59:41 -0700 |
| commit | 5bacfea89b6e2f7bd414989befcf847408be1fe7 (patch) | |
| tree | c1e1c207749ec4978e680d5ad706660c40a29b07 | |
| parent | bc0da717eb33395984b214d18a374f4abcc7c55a (diff) | |
| download | varanus-5bacfea89b6e2f7bd414989befcf847408be1fe7.tar.gz varanus-5bacfea89b6e2f7bd414989befcf847408be1fe7.tar.bz2 varanus-5bacfea89b6e2f7bd414989befcf847408be1fe7.zip | |
Better error handling
| -rw-r--r-- | src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 14b193d..8647734 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,8 +24,6 @@ * * Forecast * - * Handle "no socket file" more gracefully - * */ use std::error; @@ -295,8 +293,10 @@ fn main() { sleep(Duration::from_millis(cycle*delay_ms) - start.elapsed()); } } else { - let state = get_state(args.socket).unwrap(); - println!("{:#?}", state) + match get_state(args.socket.clone()) { + Ok(state) => println!("{:#?}", state), + Err(_) => eprintln!("Couldn't open {}", &args.socket) + } } } |
