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

@@ -34,6 +34,8 @@
#include "archive/ArchiveList.hxx"
#endif
#include <stdexcept>
#include <unistd.h>
#include <stdlib.h>
@@ -91,7 +93,7 @@ dump_input_stream(InputStream *is)
}
int main(int argc, char **argv)
{
try {
if (argc != 2) {
fprintf(stderr, "Usage: run_input URI\n");
return EXIT_FAILURE;
@@ -108,10 +110,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 */
@@ -142,4 +141,7 @@ int main(int argc, char **argv)
config_global_finish();
return ret;
} catch (const std::exception &e) {
LogError(e);
return EXIT_FAILURE;
}