summaryrefslogtreecommitdiffstats
path: root/host/lib/exception.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-24 15:22:55 -0700
committerJosh Blum <josh@joshknows.com>2011-06-24 15:22:55 -0700
commit09ed8e69312cebe31b69af4f42a3b0417774cf04 (patch)
treed6b0401308b8fb3e4c8666ea002393b563ecc99c /host/lib/exception.cpp
parent90271a6f6ef43ed6afa617ba74a70fbeb468e8f7 (diff)
downloaduhd-09ed8e69312cebe31b69af4f42a3b0417774cf04.tar.gz
uhd-09ed8e69312cebe31b69af4f42a3b0417774cf04.tar.bz2
uhd-09ed8e69312cebe31b69af4f42a3b0417774cf04.zip
uhd: added dynamic throw and clone to exceptions
Diffstat (limited to 'host/lib/exception.cpp')
-rw-r--r--host/lib/exception.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/host/lib/exception.cpp b/host/lib/exception.cpp
index ecb1fe768..ea056bd3b 100644
--- a/host/lib/exception.cpp
+++ b/host/lib/exception.cpp
@@ -27,7 +27,9 @@ exception::exception(const std::string &what):
#define make_exception_impl(name, class, base) \
class::class(const std::string &what): \
base(str(boost::format("%s: %s") % name % what)){} \
- unsigned class::code(void) const{return boost::hash<std::string>()(#class) & 0xfff;}
+ unsigned class::code(void) const{return boost::hash<std::string>()(#class) & 0xfff;} \
+ class *class::dynamic_clone(void) const{return new class(*this);} \
+ void class::dynamic_throw(void) const{throw *this;}
make_exception_impl("AssertionError", assertion_error, exception)
make_exception_impl("LookupError", lookup_error, exception)