vimus / libmpd-haskell

A client library for MPD, the Music Player Daemon
MIT License
36 stars 26 forks source link

withMPD raises IOException instead of returning Left (ConnectionError e) #114

Open crocket opened 4 years ago

crocket commented 4 years ago
*** Exception: Network.Socket.connect: <socket: 41>: does not exist (Connection refused)

I think it's supposed to return Left (ConnectionError e) instead of raising an IOException.

For now, I work around the issue with

import System.IO.Error (catchIOError)
import qualified Network.MPD as M

catchIOError (M.withMPD M.status) $ return . Left . M.ConnectionError
pjones commented 4 years ago

This happens to me as well. On my machine "localhost" first resolves to ::1 but MPD isn't listening on the IPv6 interface so the connection fails. Other tools (such as ncmpcpp) fall back to 127.0.0.1.

psibi commented 4 years ago

Happy to accept MR's for the same.