diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 21:56:43 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 21:58:39 +0200 |
commit | d6529d8c6005e42c69a9402b31ddcd9f4be4cfa6 (patch) | |
tree | b98690cc13e49bff6a58b0e5a754e17ac056e9b8 /test/run_gunzip.cxx | |
parent | edb44a536a726e6889f02ee26fb393432152ae7b (diff) |
test/*: catch and print all exceptions
Diffstat (limited to 'test/run_gunzip.cxx')
-rw-r--r-- | test/run_gunzip.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/test/run_gunzip.cxx b/test/run_gunzip.cxx index a46eeb3f1..e58d4a207 100644 --- a/test/run_gunzip.cxx +++ b/test/run_gunzip.cxx @@ -21,7 +21,7 @@ #include "fs/io/GunzipReader.hxx" #include "fs/io/FileReader.hxx" #include "fs/io/StdioOutputStream.hxx" -#include "Log.hxx" +#include "util/PrintException.hxx" #include <stdio.h> #include <stdlib.h> @@ -57,7 +57,7 @@ CopyGunzip(FILE *_dest, Path src_path) int main(int argc, gcc_unused char **argv) -{ +try { if (argc != 2) { fprintf(stderr, "Usage: run_gunzip PATH\n"); return EXIT_FAILURE; @@ -65,11 +65,9 @@ main(int argc, gcc_unused char **argv) Path path = Path::FromFS(argv[1]); - try { - CopyGunzip(stdout, path); - return EXIT_SUCCESS; - } catch (const std::exception &e) { - LogError(e); - return EXIT_FAILURE; - } + CopyGunzip(stdout, path); + return EXIT_SUCCESS; +} catch (...) { + PrintException(std::current_exception()); + return EXIT_FAILURE; } |