From 65dec113d260ff6c12271191f01ffbfafba83687 Mon Sep 17 00:00:00 2001 From: Josh Kunz Date: Wed, 10 Feb 2021 19:32:40 -0800 Subject: [PATCH] Add helpful error message for response lines >4KiB This is a temporary fix until upstream libmpdclient is fixed, or we can write our own MPD client if needed. This is a temporary fix for issue #89. --- src/mpd_client.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mpd_client.cc b/src/mpd_client.cc index 6423702..ec8bb86 100644 --- a/src/mpd_client.cc +++ b/src/mpd_client.cc @@ -207,6 +207,14 @@ void SongReaderImpl::FetchNext() { << "consider setting max_output_buffer_size to a higher value\n" << "(e.g. 32768) in your MPD config." << std::endl; } + if (err == MPD_ERROR_MALFORMED) { + std::cerr + << "libmpdclient received a malformed response from the server.\n" + << "This may be because a song's metadata attribute (for example,\n" + << "a comment) was longer than 4KiB.\n" + << "See https://github.com/joshkunz/ashuffle/issues/89 for\n" + << "details or updates." << std::endl; + } mpd_.CheckFail(); if (raw_song == nullptr) { song_ = std::nullopt;