Commit 57808d1a authored by Max Kellermann's avatar Max Kellermann

queue/Save: queue_load_song() throws on error

Don't catch and log exceptions here; let the caller decide.
parent 77756919
...@@ -95,20 +95,12 @@ queue_load_song(TextFile &file, const SongLoader &loader, ...@@ -95,20 +95,12 @@ queue_load_song(TextFile &file, const SongLoader &loader,
if ((p = StringAfterPrefix(line, SONG_BEGIN))) { if ((p = StringAfterPrefix(line, SONG_BEGIN))) {
const char *uri = p; const char *uri = p;
try { song = song_load(file, uri);
song = song_load(file, uri);
} catch (...) {
LogError(std::current_exception());
return;
}
} else { } else {
char *endptr; char *endptr;
long ret = strtol(line, &endptr, 10); long ret = strtol(line, &endptr, 10);
if (ret < 0 || *endptr != ':' || endptr[1] == 0) { if (ret < 0 || *endptr != ':' || endptr[1] == 0)
LogError(playlist_domain, throw std::runtime_error("Malformed playlist line in state file");
"Malformed playlist line in state file");
return;
}
const char *uri = endptr + 1; const char *uri = endptr + 1;
......
...@@ -35,6 +35,8 @@ queue_save(BufferedOutputStream &os, const Queue &queue); ...@@ -35,6 +35,8 @@ queue_save(BufferedOutputStream &os, const Queue &queue);
/** /**
* Loads one song from the state file and appends it to the queue. * Loads one song from the state file and appends it to the queue.
*
* Throws on error.
*/ */
void void
queue_load_song(TextFile &file, const SongLoader &loader, queue_load_song(TextFile &file, const SongLoader &loader,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment