summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-22 10:26:02 -0700
committerJosh Blum <josh@joshknows.com>2010-07-22 10:26:02 -0700
commit02be26f6b89869cb7f3ced716cf5447b913d58d5 (patch)
tree579956729c87ec93d7cbcc4cee4dd1ba35235a9b
parent5a4545d3f9689dcddd88f9316ad7bd9c489a3925 (diff)
downloaduhd-02be26f6b89869cb7f3ced716cf5447b913d58d5.tar.gz
uhd-02be26f6b89869cb7f3ced716cf5447b913d58d5.tar.bz2
uhd-02be26f6b89869cb7f3ced716cf5447b913d58d5.zip
uhd: added better throw warning to dict key not found
-rw-r--r--host/include/uhd/types/dict.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/host/include/uhd/types/dict.hpp b/host/include/uhd/types/dict.hpp
index 50a2b5c3b..de96ea768 100644
--- a/host/include/uhd/types/dict.hpp
+++ b/host/include/uhd/types/dict.hpp
@@ -20,7 +20,10 @@
#include <uhd/config.hpp>
#include <boost/foreach.hpp>
+#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
#include <stdexcept>
+#include <typeinfo>
#include <vector>
#include <list>
@@ -117,7 +120,10 @@ namespace uhd{
BOOST_FOREACH(const pair_t &p, _map){
if (p.first == key) return p.second;
}
- throw std::invalid_argument("key not found in dict");
+ throw std::invalid_argument(str(boost::format(
+ "key \"%s\" not found in dict(%s, %s)"
+ ) % boost::lexical_cast<std::string>(key)
+ % typeid(Key).name() % typeid(Val).name()));
}
/*!