Changed exception to std::out_of_range

This commit is contained in:
Joakim Hove 2018-11-09 21:14:03 +01:00
parent 1ba51534ae
commit c35832b155
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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"));
}