test/run_decoder: catch and print C++ exceptions

This commit is contained in:
Max Kellermann 2016-07-11 22:37:40 +02:00
parent b67e7df38e
commit c5fb56f90f

View File

@ -29,13 +29,15 @@
#include "util/Error.hxx" #include "util/Error.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <stdexcept>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
int main(int argc, char **argv) int main(int argc, char **argv)
{ try {
if (argc != 3) { if (argc != 3) {
fprintf(stderr, "Usage: run_decoder DECODER URI >OUT\n"); fprintf(stderr, "Usage: run_decoder DECODER URI >OUT\n");
return EXIT_FAILURE; return EXIT_FAILURE;
@ -89,5 +91,8 @@ int main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
return 0; return EXIT_SUCCESS;
} catch (const std::exception &e) {
LogError(e);
return EXIT_FAILURE;
} }