diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-02-10 19:46:04 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-02-10 19:46:04 +0000 |
commit | 73278c0a16cf0d68fb9011203a2112c3499df195 (patch) | |
tree | 6348a01ad46f20f5acdc37ab7c4fcaf1f17462a5 /json | |
parent | 40d324f102295b8eea70ec9ac6b42be417cbbfb8 (diff) |
better error message in check_type(), tell the types by name instead of by number
Diffstat (limited to 'json')
-rw-r--r-- | json/json_spirit_value.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/json/json_spirit_value.h b/json/json_spirit_value.h index e8be355300..e9bcd36b80 100644 --- a/json/json_spirit_value.h +++ b/json/json_spirit_value.h @@ -24,6 +24,7 @@ namespace json_spirit
{
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
// whether JSON Objects are represented as vectors or maps
@@ -341,7 +342,8 @@ namespace json_spirit {
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() );
}
|