From 4db1de97cea9dfab3f3abe43766053ba0d594610 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 25 Jun 2019 12:30:01 -0400 Subject: 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. --- libqpdf/QPDFObjectHandle.cc | 10 +++++----- libqpdf/QPDF_pages.cc | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libqpdf') 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"); } } -- cgit v1.2.3-54-g00ecf