Open ddavtian opened 11 years ago
this is a server error from parse as per the 502 response code. it was retried so hopefully it succeeded? in any case this isn't a client bug
"A JSON text must at least contain two octets!" is tech talk for "The JSON library got an empty string but expected some JSON, at the very least an {}
".
It might be helpful if the client would encapsulate this and instead raise an error something like Parse::ServerError
.
I'm fine with this. Wanna send a PR?
this one is actually logging of a retry, but it would be indeed be re-raised as JSON::ParserError if retries were exhausted. it would probably be preferable to encapsulate all server errors (5xx, timeout, patron, whatever) under Parse::ServerError as long as it captured the cause
I'm afraid I don't have the time to make a pull request at the moment. Possibly later, if we do a "handle Parse errors gracefully" sprint.
Hello,
I have the same issue as you had. Here is the code base I am running on.
params = {:first_name => "John", :last_name => "Smith"}
uri = URI.parse(make_uri("person/" + id.to_s)) Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
request = Net::HTTP::Patch.new(uri.request_uri)
request.add_field('Content-Type', 'application/json')
request.body = JSON.dump(params)
@response = http.request request # Net::HTTPResponse object
end
JSON.parse @response.body
I hope you would like to help me with any solution.
Best regards,
John
I think this might be an issue in the JSON parser?