Krolyxon
Commit 169ea38

rmptui169ea38

handle if mpd server is not running

Author
krolxon
Date
2024-05-14 12:00 +0530
Parent
a08c3a6
Commit
169ea381385893610fd9c43a58bf1ef3c3bb2899

+4 −1

1 file changed

  1. M src/connection.rs +4 −1
M src/connection.rs View
@@ -25,7 +25,10 @@ pub struct Connection {
2525 impl Connection {
2626 /// Create a new connection
2727 pub fn new(addrs: &str) -> Result<Self> {
28− let mut conn = Client::connect(addrs).unwrap();
28+ let mut conn = Client::connect(addrs).unwrap_or_else(|_| {
29+ eprintln!("Error connecting to mpd server, Make sure mpd is running");
30+ std::process::exit(1);
31+ });
2932
3033 let empty_song = Song {
3134 file: "No Song playing or in Queue".to_string(),