diff --git a/src/io/json.cpp b/src/io/json.cpp index e96cb25..d555c32 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -132,6 +132,11 @@ namespace fc { return token.str(); } + catch (const std::ios_base::failure&) + { + return token.str(); + } + FC_RETHROW_EXCEPTIONS( warn, "while parsing token '${token}'", ("token", token.str() ) ); } @@ -179,6 +184,10 @@ namespace fc catch( const fc::eof_exception& e ) { FC_THROW_EXCEPTION( parse_error_exception, "Unexpected EOF: ${e}", ("e", e.to_detail_string() ) ); + } + catch( const std::ios_base::failure& e ) + { + FC_THROW_EXCEPTION( parse_error_exception, "Unexpected EOF: ${e}", ("e", e.what() ) ); } FC_RETHROW_EXCEPTIONS( warn, "Error parsing object" ); } @@ -261,6 +270,9 @@ namespace fc catch (fc::eof_exception&) { } + catch (const std::ios_base::failure&) + { + } fc::string str = ss.str(); if (str == "-." || str == ".") // check the obviously wrong things we could have encountered FC_THROW_EXCEPTION(parse_error_exception, "Can't parse token \"${token}\" as a JSON numeric constant", ("token", str)); @@ -306,6 +318,10 @@ namespace fc { received_eof = true; } + catch (const std::ios_base::failure&) + { + received_eof = true; + } // we can get here either by processing a delimiter as in "null," // an EOF like "null", or an invalid token like "nullZ"