diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-01-28 13:46:04 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-01-30 19:11:03 +0100 |
commit | 0364024781ffa709a1a86ae9c6638f71df0317ca (patch) | |
tree | 7fde4d205b81d4fb65a07736d95fb1a09d746022 /libqpdf/QPDFJob.cc | |
parent | 764feb0f8e0b7753c2d3efe644561220acbc771c (diff) | |
download | qpdf-0364024781ffa709a1a86ae9c6638f71df0317ca.tar.zst |
Use QPDFUsage exception for cli, json, and QPDFJob errors
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r-- | libqpdf/QPDFJob.cc | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index b0143449..8c4efc41 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -25,21 +25,16 @@ #include <qpdf/QPDFOutlineDocumentHelper.hh> #include <qpdf/QPDFAcroFormDocumentHelper.hh> #include <qpdf/QPDFExc.hh> +#include <qpdf/QPDFUsage.hh> #include <qpdf/QPDFSystemError.hh> #include <qpdf/QPDFCryptoProvider.hh> #include <qpdf/QPDFEmbeddedFileDocumentHelper.hh> #include <qpdf/QPDFArgParser.hh> - #include <qpdf/QPDFWriter.hh> #include <qpdf/QIntC.hh> #include <qpdf/auto_job_schema.hh> // JOB_SCHEMA_DATA -QPDFJob::ConfigError::ConfigError(std::string const& msg) : - std::runtime_error(msg) -{ -} - namespace { class ImageOptimizer: public QPDFObjectHandle::StreamDataProvider @@ -452,6 +447,12 @@ QPDFJob::QPDFJob() : void +QPDFJob::usage(std::string const& msg) +{ + throw QPDFUsage(msg); +} + +void QPDFJob::setMessagePrefix(std::string const& message_prefix) { this->m->message_prefix = message_prefix; @@ -548,7 +549,7 @@ QPDFJob::parseRotationParameter(std::string const& parameter) } else { - throw ConfigError("invalid parameter to rotate: " + parameter); + usage("invalid parameter to rotate: " + parameter); } } @@ -561,7 +562,7 @@ QPDFJob::parseNumrange(char const* range, int max) } catch (std::runtime_error& e) { - throw ConfigError(e.what()); + usage(e.what()); } return std::vector<int>(); } @@ -645,10 +646,6 @@ QPDFJob::createsOutput() const void QPDFJob::checkConfiguration() { - auto usage = [](char const* msg){ - throw QPDFJob::ConfigError(msg); - }; - // QXXXQ messages are CLI-centric if (m->replace_input) { |