diff --git a/include/boost/property_map/dynamic_property_map.hpp b/include/boost/property_map/dynamic_property_map.hpp index de48520..336f000 100644 --- a/include/boost/property_map/dynamic_property_map.hpp +++ b/include/boost/property_map/dynamic_property_map.hpp @@ -102,7 +102,7 @@ struct dynamic_get_failure : public dynamic_property_exception { if(statement.empty()) statement = std::string( - "dynamic property get cannot retrieve value for property: ") + "dynamic property get cannot retrieve value for property: ") + property + "."; return statement.c_str(); diff --git a/test/dynamic_properties_test.cpp b/test/dynamic_properties_test.cpp index d5a8658..d78aa71 100644 --- a/test/dynamic_properties_test.cpp +++ b/test/dynamic_properties_test.cpp @@ -87,6 +87,14 @@ int main() { #endif BOOST_TEST(get("int",properties,std::string("one"), type()) == 1); BOOST_TEST(get("double",properties,5.3) == "five point three"); + try { + get("not_there",properties,""); + BOOST_ERROR("No exception thrown."); + } catch (boost::dynamic_get_failure& ex) { + BOOST_TEST_CSTR_EQ(ex.what(), "dynamic property get cannot retrieve value for property: not_there."); + // test idempotent error string generator branch + BOOST_TEST_CSTR_EQ(ex.what(), "dynamic property get cannot retrieve value for property: not_there."); + } } // Put tests @@ -117,7 +125,11 @@ int main() { try { put("nada",properties,3.14,std::string("3.14159")); BOOST_ERROR("No exception thrown."); - } catch (boost::property_not_found&) { } + } catch (boost::property_not_found& ex) { + BOOST_TEST_CSTR_EQ(ex.what(), "Property not found: nada."); + // test idempotent error string generator branch + BOOST_TEST_CSTR_EQ(ex.what(), "Property not found: nada."); + } } // Nonexistent property gets generated