fs/io/OutputStream: use C++ exceptions in Write()

This commit is contained in:
Max Kellermann
2015-12-16 10:24:43 +01:00
parent 36d6ead65c
commit e4a06da14e
24 changed files with 241 additions and 333 deletions

View File

@@ -75,12 +75,12 @@ StateFile::Write(BufferedOutputStream &os)
playlist_state_save(os, partition.playlist, partition.pc);
}
inline bool
StateFile::Write(OutputStream &os, Error &error)
inline void
StateFile::Write(OutputStream &os)
{
BufferedOutputStream bos(os);
Write(bos);
return bos.Flush(error);
bos.Flush();
}
void
@@ -90,13 +90,8 @@ StateFile::Write()
"Saving state file %s", path_utf8.c_str());
try {
Error error;
FileOutputStream fos(path);
if (!Write(fos, error)) {
LogError(error);
return;
}
Write(fos);
fos.Commit();
} catch (const std::exception &e) {
LogError(e);