summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-11 19:59:27 +0100
committerMax Kellermann <max@musicpd.org>2018-01-11 20:08:01 +0100
commit7fe07324d7f7174f9e3868a74c3d3ce2a8073632 (patch)
tree5200b920a87c32202b0ddbd6390c6796d8dbde8d /src
parent8e29430f215f9c71f113604b2e640b0145929f78 (diff)
playlist/SoundCloud: soundcloud_parse_json() throws exception
Diffstat (limited to 'src')
-rw-r--r--src/playlist/plugins/SoundCloudPlaylistPlugin.cxx15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
index 276de5c52..9813c58ed 100644
--- a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
@@ -221,12 +221,11 @@ static constexpr yajl_callbacks parse_callbacks = {
* Read JSON data and parse it using the given YAJL parser.
* @param url URL of the JSON data.
* @param handle YAJL parser handle.
- * @return -1 on error, 0 on success.
*/
-static int
+static void
soundcloud_parse_json(const char *url, Yajl::Handle &handle,
Mutex &mutex, Cond &cond)
-try {
+{
auto input_stream = InputStream::OpenReady(url, mutex, cond);
const std::lock_guard<Mutex> protect(mutex);
@@ -245,11 +244,6 @@ try {
} else
handle.Parse(buffer, nbytes);
}
-
- return 0;
-} catch (const std::exception &e) {
- LogError(e);
- return -1;
}
/**
@@ -302,10 +296,7 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
SoundCloudJsonData data;
Yajl::Handle handle(&parse_callbacks, nullptr, &data);
- int ret = soundcloud_parse_json(u, handle, mutex, cond);
-
- if (ret == -1)
- return nullptr;
+ soundcloud_parse_json(u, handle, mutex, cond);
data.songs.reverse();
return new MemorySongEnumerator(std::move(data.songs));