From b9741d94330948ffa535e13422b9a98fdc4039be Mon Sep 17 00:00:00 2001 From: Alek Mosingiewicz Date: Mon, 13 Aug 2018 18:25:43 +0200 Subject: [PATCH] Make conversion_error inherit from bad_boxed_cast. --- .../chaiscript/dispatchkit/type_conversions.hpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index caec282a..20f1295e 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -31,22 +31,14 @@ namespace chaiscript namespace exception { /// \brief Error thrown when there's a problem with type conversion - class conversion_error + class conversion_error: public bad_boxed_cast { public: - conversion_error(const Type_Info t_to, const Type_Info t_from, const utility::Static_String what): to(t_to), - from(t_from), m_what(std::move(what)) {}; + conversion_error(const Type_Info t_to, const Type_Info t_from, const utility::Static_String what) noexcept + : bad_boxed_cast(t_from, (*t_to.bare_type_info()), what), type_to(t_to) {}; - const char * what() const noexcept - { - return m_what.c_str(); - } + Type_Info type_to; - Type_Info to; - Type_Info from; - - private: - utility::Static_String m_what; };