Commit a1ef0159 authored by Max Kellermann's avatar Max Kellermann

playlist/PlaylistStream: catch and log C++ exceptions

parent 1c5f7663
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static SongEnumerator * static SongEnumerator *
playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond) playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond)
{ try {
assert(!path.IsNull()); assert(!path.IsNull());
const auto *suffix = path.GetSuffix(); const auto *suffix = path.GetSuffix();
...@@ -58,11 +58,14 @@ playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond) ...@@ -58,11 +58,14 @@ playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond)
delete is; delete is;
return playlist; return playlist;
} catch (const std::runtime_error &e) {
LogError(e);
return nullptr;
} }
SongEnumerator * SongEnumerator *
playlist_open_path(Path path, Mutex &mutex, Cond &cond) playlist_open_path(Path path, Mutex &mutex, Cond &cond)
{ try {
assert(!path.IsNull()); assert(!path.IsNull());
const std::string uri_utf8 = path.ToUTF8(); const std::string uri_utf8 = path.ToUTF8();
...@@ -73,11 +76,14 @@ playlist_open_path(Path path, Mutex &mutex, Cond &cond) ...@@ -73,11 +76,14 @@ playlist_open_path(Path path, Mutex &mutex, Cond &cond)
playlist = playlist_open_path_suffix(path, mutex, cond); playlist = playlist_open_path_suffix(path, mutex, cond);
return playlist; return playlist;
} catch (const std::runtime_error &e) {
LogError(e);
return nullptr;
} }
SongEnumerator * SongEnumerator *
playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond) playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond)
{ try {
assert(uri_has_scheme(uri)); assert(uri_has_scheme(uri));
SongEnumerator *playlist = playlist_list_open_uri(uri, mutex, cond); SongEnumerator *playlist = playlist_list_open_uri(uri, mutex, cond);
...@@ -100,4 +106,7 @@ playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond) ...@@ -100,4 +106,7 @@ playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond)
} }
return new CloseSongEnumerator(playlist, is); return new CloseSongEnumerator(playlist, is);
} catch (const std::runtime_error &e) {
LogError(e);
return nullptr;
} }
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