This commit is contained in:
Daniel Larimer 2014-06-04 22:18:39 +00:00
commit 2e109d18c9

View file

@ -132,6 +132,11 @@ namespace fc
{ {
return token.str(); return token.str();
} }
catch (const std::ios_base::failure&)
{
return token.str();
}
FC_RETHROW_EXCEPTIONS( warn, "while parsing token '${token}'", FC_RETHROW_EXCEPTIONS( warn, "while parsing token '${token}'",
("token", token.str() ) ); ("token", token.str() ) );
} }
@ -179,6 +184,10 @@ namespace fc
catch( const fc::eof_exception& e ) catch( const fc::eof_exception& e )
{ {
FC_THROW_EXCEPTION( parse_error_exception, "Unexpected EOF: ${e}", ("e", e.to_detail_string() ) ); 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" ); } FC_RETHROW_EXCEPTIONS( warn, "Error parsing object" );
} }
@ -261,6 +270,9 @@ namespace fc
catch (fc::eof_exception&) catch (fc::eof_exception&)
{ {
} }
catch (const std::ios_base::failure&)
{
}
fc::string str = ss.str(); fc::string str = ss.str();
if (str == "-." || str == ".") // check the obviously wrong things we could have encountered 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)); 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; received_eof = true;
} }
catch (const std::ios_base::failure&)
{
received_eof = true;
}
// we can get here either by processing a delimiter as in "null," // we can get here either by processing a delimiter as in "null,"
// an EOF like "null<EOF>", or an invalid token like "nullZ" // an EOF like "null<EOF>", or an invalid token like "nullZ"