db/simple/Song: allow LoadFile(), UpdateFile() to throw
Preparing to move logger calls out of lower-level libaries, and propagating error details to the caller instead.
This commit is contained in:
@@ -33,7 +33,7 @@ inline void
|
||||
UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
try {
|
||||
Song *song;
|
||||
{
|
||||
const ScopeDatabaseLock protect;
|
||||
@@ -61,6 +61,7 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
if (song == nullptr) {
|
||||
FormatDebug(update_domain, "reading %s/%s",
|
||||
directory.GetPath(), name);
|
||||
|
||||
auto new_song = Song::LoadFile(storage, name, directory);
|
||||
if (!new_song) {
|
||||
FormatDebug(update_domain,
|
||||
@@ -89,6 +90,10 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
|
||||
modified = true;
|
||||
}
|
||||
} catch (...) {
|
||||
FormatError(std::current_exception(),
|
||||
"error reading file %s/%s",
|
||||
directory.GetPath(), name);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user