diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-05-14 12:00:13 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-05-14 12:00:13 +0530 |
| commit | 169ea381385893610fd9c43a58bf1ef3c3bb2899 (patch) | |
| tree | 8211b849ab7e8a9455646970c91a39d7007a7691 /src/connection.rs | |
| parent | a08c3a6e785d8a6e39497ef2b6d6529589cb39f0 (diff) | |
handle if mpd server is not running
Diffstat (limited to 'src/connection.rs')
| -rwxr-xr-x | src/connection.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/connection.rs b/src/connection.rs index 7afb3d2..f98310d 100755 --- a/src/connection.rs +++ b/src/connection.rs @@ -25,7 +25,10 @@ pub struct Connection { impl Connection { /// Create a new connection pub fn new(addrs: &str) -> Result<Self> { - let mut conn = Client::connect(addrs).unwrap(); + let mut conn = Client::connect(addrs).unwrap_or_else(|_| { + eprintln!("Error connecting to mpd server, Make sure mpd is running"); + std::process::exit(1); + }); let empty_song = Song { file: "No Song playing or in Queue".to_string(), |
