t/json-validate: catch only json exceptions

the json namespace should really only be throwing json errors. this tool
is primarily used for unit testing, so it's better it crashes
catastrophically on an unhandled exception.
This commit is contained in:
Danny Robson 2016-04-27 17:10:36 +10:00
parent 2fbf9af8cb
commit 456362adff

View File

@ -16,6 +16,7 @@
*/ */
#include "json/flat.hpp" #include "json/flat.hpp"
#include "json/except.hpp"
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
@ -41,8 +42,8 @@ main (int argc, char ** argv) {
try { try {
json::flat::parse (boost::filesystem::path (argv[ARG_PATH])); json::flat::parse (boost::filesystem::path (argv[ARG_PATH]));
} catch (std::exception &x) { } catch (const json::error &x) {
std::cerr << "Error: " << x.what () << std::endl; std::cerr << "error: " << x.what () << '\n';
return EXIT_FAILURE; return EXIT_FAILURE;
} }