archive/Plugin: migrate open() from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-09 18:34:55 +02:00
parent fc7d3f64c0
commit 220d9528a3
9 changed files with 27 additions and 49 deletions

View File

@@ -29,7 +29,6 @@
#include "fs/Path.hxx"
#include "Log.hxx"
#include "util/ScopeExit.hxx"
#include "util/Error.hxx"
#include <stdexcept>
@@ -61,10 +60,7 @@ OpenArchiveInputStream(Path path, Mutex &mutex, Cond &cond)
return nullptr;
}
Error error;
auto file = archive_file_open(arplug, Path::FromFS(archive), error);
if (file == nullptr)
throw std::runtime_error(error.GetMessage());
auto file = archive_file_open(arplug, Path::FromFS(archive));
AtScopeExit(file) {
file->Close();