Adds some documentation to OpmInputError.hpp.

This commit is contained in:
Williham Williham Totland
2020-09-28 12:23:58 +02:00
parent 9a66acbb5d
commit 805300dd49
2 changed files with 39 additions and 1 deletions

View File

@@ -22,6 +22,8 @@
#include <boost/test/unit_test.hpp>
#include <exception>
#include <opm/common/utility/OpmInputError.hpp>
const Opm::KeywordLocation location { "MXUNSUPP", "FILENAME.DAT", 42 } ;
@@ -83,3 +85,19 @@ Reason: Runtime Error)" };
BOOST_CHECK_EQUAL(formatted, expected);
}
BOOST_AUTO_TEST_CASE(exception_nest) {
const std::string expected { R"(Problem parsing keyword MXUNSUPP
In FILENAME.DAT line 42.
Internal error message: Runtime Error)" };
try {
try {
throw std::runtime_error("Runtime Error");
} catch (const std::exception& e) {
std::throw_with_nested(Opm::OpmInputError(location, e));
}
} catch (const Opm::OpmInputError& opm_error) {
BOOST_CHECK_EQUAL(opm_error.what(), expected);
}
}