aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/JSONHandler.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-28 13:46:04 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commit0364024781ffa709a1a86ae9c6638f71df0317ca (patch)
tree7fde4d205b81d4fb65a07736d95fb1a09d746022 /libqpdf/JSONHandler.cc
parent764feb0f8e0b7753c2d3efe644561220acbc771c (diff)
downloadqpdf-0364024781ffa709a1a86ae9c6638f71df0317ca.tar.zst
Use QPDFUsage exception for cli, json, and QPDFJob errors
Diffstat (limited to 'libqpdf/JSONHandler.cc')
-rw-r--r--libqpdf/JSONHandler.cc20
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");
}
}