Commit 34759075 authored by Max Kellermann's avatar Max Kellermann

SongLoader: throw PlaylistError on error

parent fe4b1f96
...@@ -45,11 +45,10 @@ SongLoader::LoadFromDatabase(const char *uri, Error &error) const ...@@ -45,11 +45,10 @@ SongLoader::LoadFromDatabase(const char *uri, Error &error) const
return DatabaseDetachSong(*db, *storage, uri, error); return DatabaseDetachSong(*db, *storage, uri, error);
#else #else
(void)uri; (void)uri;
(void)error;
#endif #endif
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_SONG), throw PlaylistError(PlaylistResult::NO_SUCH_SONG, "No database");
"No database");
return nullptr;
} }
DetachedSong * DetachedSong *
...@@ -63,14 +62,13 @@ SongLoader::LoadFile(const char *path_utf8, Path path_fs, Error &error) const ...@@ -63,14 +62,13 @@ SongLoader::LoadFile(const char *path_utf8, Path path_fs, Error &error) const
directory - obtain it from the database */ directory - obtain it from the database */
return LoadFromDatabase(suffix, error); return LoadFromDatabase(suffix, error);
} }
#else
(void)error;
#endif #endif
DetachedSong song(path_utf8); DetachedSong song(path_utf8);
if (!song.LoadFile(path_fs)) { if (!song.LoadFile(path_fs))
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_SONG), throw PlaylistError::NoSuchSong();
"No such file");
return nullptr;
}
return new DetachedSong(std::move(song)); return new DetachedSong(std::move(song));
} }
......
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