diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-06-25 18:30:01 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-06-25 18:43:06 +0200 |
commit | 4db1de97cea9dfab3f3abe43766053ba0d594610 (patch) | |
tree | 61ead5970dc0e3d57af683caad664d084e2715ea /libqpdf | |
parent | 201e8798d75c34498a39c31a7e2c73433bb6a8d8 (diff) | |
download | qpdf-4db1de97cea9dfab3f3abe43766053ba0d594610.tar.zst |
Convert some cases of logic_error to runtime_error
There were a few cases that could be caused by invalid input rather
than bugs in the code which were throwing logic_error instead of
runtime_error.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 10 | ||||
-rw-r--r-- | libqpdf/QPDF_pages.cc | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index a3605604..6f9671d5 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -2515,7 +2515,7 @@ QPDFObjectHandle::warnIfPossible(std::string const& warning, } else if (throw_if_no_description) { - throw std::logic_error(warning); + throw std::runtime_error(warning); } } @@ -2530,9 +2530,9 @@ QPDFObjectHandle::assertType(char const* type_name, bool istype) { if (! istype) { - throw std::logic_error(std::string("operation for ") + type_name + - " attempted on object of type " + - getTypeName()); + throw std::runtime_error(std::string("operation for ") + type_name + + " attempted on object of type " + + getTypeName()); } } @@ -2670,7 +2670,7 @@ QPDFObjectHandle::assertPageObject() { if (! isPageObject()) { - throw std::logic_error("page operation called on non-Page object"); + throw std::runtime_error("page operation called on non-Page object"); } } diff --git a/libqpdf/QPDF_pages.cc b/libqpdf/QPDF_pages.cc index fe23e850..d95002a6 100644 --- a/libqpdf/QPDF_pages.cc +++ b/libqpdf/QPDF_pages.cc @@ -166,7 +166,7 @@ QPDF::flattenPagesTree() // /Count has not changed if (pages.getKey("/Count").getUIntValue() != len) { - throw std::logic_error("/Count is wrong after flattening pages tree"); + throw std::runtime_error("/Count is wrong after flattening pages tree"); } } |