From ef8f257520f48e80d8e02c0f3a1d127d14fe14e0 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 9 Jun 2014 12:01:52 -0400 Subject: [PATCH] support for derived exceptions --- include/fc/exception/exception.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/fc/exception/exception.hpp b/include/fc/exception/exception.hpp index 0bb289a..3e78fe4 100644 --- a/include/fc/exception/exception.hpp +++ b/include/fc/exception/exception.hpp @@ -217,6 +217,12 @@ namespace fc enum code_enum { \ code_value = CODE, \ }; \ + explicit TYPE( int64_t code, const std::string& name_value, const std::string& what_value ) \ + :BASE( code, name_value, what_value ){} \ + explicit TYPE( fc::log_message&& m, int64_t code, const std::string& name_value, const std::string& what_value ) \ + :BASE( std::move(m), code, name_value, what_value ){} \ + explicit TYPE( fc::log_messages&& m, int64_t code, const std::string& name_value, const std::string& what_value )\ + :BASE( std::move(m), code, name_value, what_value ){}\ TYPE( fc::log_message&& m ) \ :BASE( fc::move(m), CODE, BOOST_PP_STRINGIZE(TYPE), WHAT ){}\ TYPE( fc::log_messages msgs ) \ @@ -225,13 +231,13 @@ namespace fc :BASE(c){} \ TYPE( const BASE& c ) \ :BASE(c){} \ - TYPE():BASE(CODE, BOOST_PP_STRINGIZE(TYPE), WHAT){}\ + TYPE():exception(CODE, BOOST_PP_STRINGIZE(TYPE), WHAT){}\ \ - virtual std::shared_ptr dynamic_copy_exception()const\ + virtual std::shared_ptr dynamic_copy_exception()const\ { return std::make_shared( *this ); } \ virtual NO_RETURN void dynamic_rethrow_exception()const \ { if( code() == CODE ) throw *this;\ - else BASE::dynamic_rethrow_exception(); \ + else fc::exception::dynamic_rethrow_exception(); \ } \ };