Overview
Features
Download
Documentation
Community
Add-Ons & Services

JSON::Parser::parse(const std::string&) wrong implementation

Please post support and help requests here.

JSON::Parser::parse(const std::string&) wrong implementation

Postby Paranaix » 20 Jan 2014, 22:09

Poco 1.5.2

parse(const std::string&):
Code: Select all
   while(source.nextChar(c))
   {
      if (0 == parseChar(c, source))
         throw SyntaxException("JSON syntax error");
   }

   if (!done())
      throw JSONException("JSON syntax error");
}


parse(std::istream&):
Code: Select all
   while(source.nextChar(c))
   {
      if (0 == parseChar(c, source)) throw JSONException("JSON syntax error");
   }

   if (!done())
      throw JSONException("JSON syntax error");
}


Ithink throw SyntaxException("JSON syntax error"); should be throw JSONException("JSON syntax error"); for the string version.
Also notice that it would be good to know what char caused the error (with position) and if possible why (e.g "expected xyz"; parseChar() would need to throw the exception for this).
Another improvement could be a more detailed explanation for if (!done()). I guess it could be something like "Syntax error: Cant find end"
Paranaix
 
Posts: 4
Joined: 08 Jan 2012, 21:52

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest