Changed exception to std::out_of_range
This commit is contained in:
parent
1ba51534ae
commit
c35832b155
@ -35,7 +35,7 @@ namespace Opm{
|
|||||||
double SummaryState::get(const std::string& key) const {
|
double SummaryState::get(const std::string& key) const {
|
||||||
const auto iter = this->values.find(key);
|
const auto iter = this->values.find(key);
|
||||||
if (iter == this->values.end())
|
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;
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
@ -1303,7 +1303,7 @@ BOOST_AUTO_TEST_CASE(Test_SummaryState) {
|
|||||||
Opm::SummaryState st;
|
Opm::SummaryState st;
|
||||||
st.add("WWCT:OP_2", 100);
|
st.add("WWCT:OP_2", 100);
|
||||||
BOOST_CHECK_CLOSE(st.get("WWCT:OP_2"), 100, 1e-5);
|
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("WWCT:OP_2"));
|
||||||
BOOST_CHECK(!st.has("NO_SUCH_KEY"));
|
BOOST_CHECK(!st.has("NO_SUCH_KEY"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user