dgalli1 / ytm-mpd

GNU General Public License v3.0
9 stars 0 forks source link

Improve error message if client fails to connect #4

Closed vari closed 9 months ago

vari commented 9 months ago

Updated initialization of the MPDPlayer class so that we wait until the connection to MPD succeeds before trying to start the YoutubeCastReceiver. In case of a connection issue with MPD, this makes it so that the error message provides useful info that the user can use to fix the issue.

Context: I was trying out this app in docker and had trouble getting it to work. The container was failing with very cryptic error messages (some turned out to be false positives from the yt-cast-receiver package, the releavant one was undefined field for this.client in the event listener). After doing a local checkout of the repo and some troubleshooting, I realized that my issue was caused by ytm-mpd not being able to connect to MPD (due to a setup/config issue in my env). To figure this out, I updated the start up code so that we wait until the MPD connection succeds before doing anything else.

I figured it would be useful to have these changes merged so that if others run into a similar issue, they can root cause & resolve it faster.

Also made some minor changes to fix indentation in index.ts

dgalli1 commented 9 months ago

Looks fine.

Thanks for the pr