fs/io/FileOutputStream: use C++ exceptions in constructor
This commit is contained in:
@@ -379,9 +379,7 @@ SimpleDatabase::Save(Error &error)
|
||||
|
||||
LogDebug(simple_db_domain, "writing DB");
|
||||
|
||||
FileOutputStream fos(path, error);
|
||||
if (!fos.IsDefined())
|
||||
return false;
|
||||
FileOutputStream fos(path);
|
||||
|
||||
OutputStream *os = &fos;
|
||||
|
||||
|
||||
@@ -129,9 +129,13 @@ UpdateService::Task()
|
||||
next.discard);
|
||||
|
||||
if (modified || !next.db->FileExists()) {
|
||||
Error error;
|
||||
if (!next.db->Save(error))
|
||||
LogError(error, "Failed to save database");
|
||||
try {
|
||||
Error error;
|
||||
if (!next.db->Save(error))
|
||||
LogError(error, "Failed to save database");
|
||||
} catch (const std::exception &e) {
|
||||
LogError(e, "Failed to save database");
|
||||
}
|
||||
}
|
||||
|
||||
if (!next.path_utf8.empty())
|
||||
|
||||
Reference in New Issue
Block a user