input/Plugin: migrate init() from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-09-05 12:05:54 +02:00
parent a73688a2be
commit 6ed77f2a27
15 changed files with 55 additions and 99 deletions

View File

@@ -31,6 +31,8 @@
#include "archive/ArchiveList.hxx"
#endif
#include <stdexcept>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -63,7 +65,7 @@ dump_input_stream(InputStreamPtr &&is)
}
int main(int argc, char **argv)
{
try {
int ret;
if (argc != 2) {
@@ -82,10 +84,7 @@ int main(int argc, char **argv)
#endif
Error error;
if (!input_stream_global_init(error)) {
LogError(error);
return 2;
}
input_stream_global_init();
/* open the stream and dump it */
@@ -116,4 +115,7 @@ int main(int argc, char **argv)
config_global_finish();
return ret;
} catch (const std::exception &e) {
LogError(e);
return EXIT_FAILURE;
}