diff options
author | Max Kellermann <max@duempel.org> | 2015-12-28 06:43:41 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-12-28 06:44:01 +0100 |
commit | fe0b6a111701624cbbd14b942d494795c98044d8 (patch) | |
tree | 1919b7c6fb359dcb51d53036d316c93e4d60b1f7 /src/PlaylistFile.cxx | |
parent | 72851647ca49c20e8c9cb4908273ce703c5f6aab (diff) |
PlaylistFile: convert system_error::ENOENT to PlaylistResult::NO_SUCH_LIST
Diffstat (limited to 'src/PlaylistFile.cxx')
-rw-r--r-- | src/PlaylistFile.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index 8b86afcfc..ae7c16447 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -247,7 +247,7 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path, PlaylistFileContents LoadPlaylistFile(const char *utf8path, Error &error) -{ +try { PlaylistFileContents contents; const auto path_fs = spl_map_to_fs(utf8path, error); @@ -301,6 +301,10 @@ LoadPlaylistFile(const char *utf8path, Error &error) } return contents; +} catch (const std::system_error &e) { + if (IsFileNotFound(e)) + throw PlaylistError::NoSuchList(); + throw; } bool @@ -393,7 +397,7 @@ spl_remove_index(const char *utf8path, unsigned pos, Error &error) bool spl_append_song(const char *utf8path, const DetachedSong &song, Error &error) -{ +try { const auto path_fs = spl_map_to_fs(utf8path, error); if (path_fs.IsNull()) return false; @@ -415,6 +419,10 @@ spl_append_song(const char *utf8path, const DetachedSong &song, Error &error) idle_add(IDLE_STORED_PLAYLIST); return true; +} catch (const std::system_error &e) { + if (IsFileNotFound(e)) + throw PlaylistError::NoSuchList(); + throw; } bool |