From 57808d1a1ba9f156bf6e193dfa6a0f3cc088d64d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Sep 2019 20:55:18 +0200 Subject: [PATCH] queue/Save: queue_load_song() throws on error Don't catch and log exceptions here; let the caller decide. --- src/queue/QueueSave.cxx | 14 +++----------- src/queue/QueueSave.hxx | 2 ++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/queue/QueueSave.cxx b/src/queue/QueueSave.cxx index 5c2c79d09..c2d6a61bb 100644 --- a/src/queue/QueueSave.cxx +++ b/src/queue/QueueSave.cxx @@ -95,20 +95,12 @@ queue_load_song(TextFile &file, const SongLoader &loader, if ((p = StringAfterPrefix(line, SONG_BEGIN))) { const char *uri = p; - try { - song = song_load(file, uri); - } catch (...) { - LogError(std::current_exception()); - return; - } + song = song_load(file, uri); } else { char *endptr; long ret = strtol(line, &endptr, 10); - if (ret < 0 || *endptr != ':' || endptr[1] == 0) { - LogError(playlist_domain, - "Malformed playlist line in state file"); - return; - } + if (ret < 0 || *endptr != ':' || endptr[1] == 0) + throw std::runtime_error("Malformed playlist line in state file"); const char *uri = endptr + 1; diff --git a/src/queue/QueueSave.hxx b/src/queue/QueueSave.hxx index bb661aa50..e15686bcb 100644 --- a/src/queue/QueueSave.hxx +++ b/src/queue/QueueSave.hxx @@ -35,6 +35,8 @@ queue_save(BufferedOutputStream &os, const Queue &queue); /** * Loads one song from the state file and appends it to the queue. + * + * Throws on error. */ void queue_load_song(TextFile &file, const SongLoader &loader,