diff options
author | Max Kellermann <max@musicpd.org> | 2016-09-05 12:05:54 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-09-09 15:16:47 +0200 |
commit | 6ed77f2a27c332218a7144606af90404ba433397 (patch) | |
tree | 7956e951258cbeff5e410dae5bc8689c50ca3304 /test/visit_archive.cxx | |
parent | a73688a2be74ee6b5e68bfafa8d84e6cfe00bf5d (diff) |
input/Plugin: migrate init() from class Error to C++ exceptions
Diffstat (limited to 'test/visit_archive.cxx')
-rw-r--r-- | test/visit_archive.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index 6b50867b5..96c2eb9d2 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -28,6 +28,9 @@ #include "archive/ArchiveVisitor.hxx" #include "fs/Path.hxx" #include "util/Error.hxx" +#include "Log.hxx" + +#include <stdexcept> #include <unistd.h> #include <stdlib.h> @@ -42,7 +45,7 @@ class MyArchiveVisitor final : public ArchiveVisitor { int main(int argc, char **argv) -{ +try { Error error; if (argc != 3) { @@ -61,10 +64,7 @@ main(int argc, char **argv) archive_plugin_init_all(); - if (!input_stream_global_init(error)) { - fprintf(stderr, "%s", error.GetMessage()); - return 2; - } + input_stream_global_init(); /* open the archive and dump it */ @@ -95,4 +95,7 @@ main(int argc, char **argv) config_global_finish(); return result; +} catch (const std::exception &e) { + LogError(e); + return EXIT_FAILURE; } |