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

@@ -30,11 +30,11 @@
#include "archive/ArchivePlugin.hxx"
#include "archive/ArchiveFile.hxx"
#include "archive/ArchiveVisitor.hxx"
#include "util/Error.hxx"
#include "util/StringCompare.hxx"
#include "Log.hxx"
#include <string>
#include <stdexcept>
#include <string.h>
@@ -150,10 +150,11 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
return;
/* open archive */
Error error;
ArchiveFile *file = archive_file_open(&plugin, path_fs, error);
if (file == nullptr) {
LogError(error);
ArchiveFile *file;
try {
file = archive_file_open(&plugin, path_fs);
} catch (const std::runtime_error &e) {
LogError(e);
if (directory != nullptr)
editor.LockDeleteDirectory(directory);
return;