diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp index a2b82884c..c5f8b0a91 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp @@ -35,7 +35,7 @@ namespace Opm{ double SummaryState::get(const std::string& key) const { const auto iter = this->values.find(key); if (iter == this->values.end()) - throw std::invalid_argument("XX No such key: " + key); + throw std::out_of_range("No such key: " + key); return iter->second; } diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index b49348759..b1f729d5c 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -1303,7 +1303,7 @@ BOOST_AUTO_TEST_CASE(Test_SummaryState) { Opm::SummaryState st; st.add("WWCT:OP_2", 100); BOOST_CHECK_CLOSE(st.get("WWCT:OP_2"), 100, 1e-5); - BOOST_CHECK_THROW(st.get("NO_SUCH_KEY"), std::invalid_argument); + BOOST_CHECK_THROW(st.get("NO_SUCH_KEY"), std::out_of_range); BOOST_CHECK(st.has("WWCT:OP_2")); BOOST_CHECK(!st.has("NO_SUCH_KEY")); }