From 8c370b06e6639a75f5077549465bfbf3b1ea3fd2 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Thu, 15 May 2014 17:44:38 -0400 Subject: [PATCH] update json error handling --- src/io/json.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/io/json.cpp b/src/io/json.cpp index 7be1620..e17729e 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -248,6 +248,10 @@ namespace fc ss.put( in.get() ); break; default: + if( isalnum( c ) ) + { + return ss.str() + stringFromToken( in ); + } done = true; break; } @@ -270,12 +274,11 @@ namespace fc { std::stringstream ss; ss.exceptions( std::ifstream::badbit ); - bool parsed_unexpected_character = false; bool received_eof = false; try { char c; - while((c = in.peek()) && !parsed_unexpected_character) + while((c = in.peek()) ) { switch( c ) { @@ -291,8 +294,7 @@ namespace fc ss.put( in.get() ); break; default: - parsed_unexpected_character = true; - break; + return ss.str() + stringFromToken(in); } } }