mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-25 14:25:01 +00:00
better error message in check_type(), tell the types by name instead of by number
This commit is contained in:
parent
40d324f102
commit
73278c0a16
@ -24,6 +24,7 @@
|
|||||||
namespace json_spirit
|
namespace json_spirit
|
||||||
{
|
{
|
||||||
enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type };
|
enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type };
|
||||||
|
static const char* Value_type_name[]={"obj", "array", "str", "bool", "int", "real", "null"};
|
||||||
|
|
||||||
template< class Config > // Config determines whether the value uses std::string or std::wstring and
|
template< class Config > // Config determines whether the value uses std::string or std::wstring and
|
||||||
// whether JSON Objects are represented as vectors or maps
|
// whether JSON Objects are represented as vectors or maps
|
||||||
@ -341,7 +342,8 @@ namespace json_spirit
|
|||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
os << "value type is " << type() << " not " << vtype;
|
/// satoshi: tell the types by name instead of by number
|
||||||
|
os << "value is type " << Value_type_name[type()] << ", expected " << Value_type_name[vtype];
|
||||||
|
|
||||||
throw std::runtime_error( os.str() );
|
throw std::runtime_error( os.str() );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user