Adds some documentation to OpmInputError.hpp.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user