enhance error message in variant

This commit is contained in:
Daniel Larimer 2014-04-25 15:17:06 -04:00
parent 61f2ac4679
commit 9301771405

View file

@ -486,7 +486,7 @@ const string& variant::get_string()const
{
if( get_type() == string_type )
return **reinterpret_cast<const const_string_ptr*>(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<const const_variant_object_ptr*>(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 )