From 9301771405375a7977d9f8d364e85d3721313459 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 25 Apr 2014 15:17:06 -0400 Subject: [PATCH] enhance error message in variant --- src/variant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/variant.cpp b/src/variant.cpp index 1917d7d..c6077f1 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -486,7 +486,7 @@ const string& variant::get_string()const { if( get_type() == string_type ) return **reinterpret_cast(this); - FC_THROW_EXCEPTION( bad_cast_exception, "Invalid cast from ${type} to Object" ); + FC_THROW_EXCEPTION( bad_cast_exception, "Invalid cast from type '${type}' to Object", ("type",int(get_type())) ); } @@ -495,7 +495,7 @@ const variant_object& variant::get_object()const { if( get_type() == object_type ) return **reinterpret_cast(this); - FC_THROW_EXCEPTION( bad_cast_exception, "Invalid cast from ${type} to Object" ); + FC_THROW_EXCEPTION( bad_cast_exception, "Invalid cast from type '${type}' to Object", ("type",int(get_type())) ); } void to_variant( const std::string& s, variant& v )