diff options
Diffstat (limited to 'libqpdf/JSONHandler.cc')
-rw-r--r-- | libqpdf/JSONHandler.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libqpdf/JSONHandler.cc b/libqpdf/JSONHandler.cc index 5e3d9a8d..1d374e6a 100644 --- a/libqpdf/JSONHandler.cc +++ b/libqpdf/JSONHandler.cc @@ -1,11 +1,7 @@ #include <qpdf/JSONHandler.hh> #include <qpdf/QUtil.hh> #include <qpdf/QTC.hh> - -JSONHandler::Error::Error(std::string const& msg) : - std::runtime_error(msg) -{ -} +#include <qpdf/QPDFUsage.hh> JSONHandler::JSONHandler() : m(new Members()) @@ -17,6 +13,12 @@ JSONHandler::Members::Members() } void +JSONHandler::usage(std::string const& msg) +{ + throw QPDFUsage(msg); +} + +void JSONHandler::addAnyHandler(json_handler_t fn) { this->m->h.any_handler = fn; @@ -128,9 +130,8 @@ JSONHandler::handle(std::string const& path, JSON j) else { QTC::TC("libtests", "JSONHandler unexpected key"); - throw Error( - "JSON handler found unexpected key " + k + - " in object at " + path); + usage("JSON handler found unexpected key " + k + + " in object at " + path); } } else @@ -163,7 +164,6 @@ JSONHandler::handle(std::string const& path, JSON j) // different if this code were trying to be part of a // general-purpose JSON package. QTC::TC("libtests", "JSONHandler unhandled value"); - throw Error("JSON handler: value at " + path + - " is not of expected type"); + usage("JSON handler: value at " + path + " is not of expected type"); } } |