poor assumption, facebook always returns JSON

RESOLVED WONTFIX

Status

Cloud Services
Server: Share
RESOLVED WONTFIX
7 years ago
7 years ago

People

(Reporter: clarkbw, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

== copied from: https://github.com/mozilla/f1/issues#issue/62 ==

Apparently (and probably in the case of 500 errors at least), facebook doesn't always return json. The facebook send code makes no attempt to catch non-json responses.

From the prod logs:

[Sun Feb 20 19:57:43 2011] [error] 19:57:43,496 ERROR [linkdrop.controllers.send] [MainThread] error providing item to facebook.com: No JSON object could be decoded
[Sun Feb 20 19:57:43 2011] [error] Traceback (most recent call last):
[Sun Feb 20 19:57:43 2011] [error]   File "/home/linkdrop/linkdrop/linkdrop/controllers/send.py", line 172, in send
[Sun Feb 20 19:57:43 2011] [error]     result, error = provider.api(acct).sendmessage(message, args)
[Sun Feb 20 19:57:43 2011] [error]   File "/home/linkdrop/linkdrop/linkdrop/lib/oauth/facebook_.py", line 261, in sendmessage
[Sun Feb 20 19:57:43 2011] [error]     return self.rawcall(url, body, "POST")
[Sun Feb 20 19:57:43 2011] [error]   File "/home/linkdrop/linkdrop/linkdrop/lib/oauth/facebook_.py", line 225, in rawcall
[Sun Feb 20 19:57:43 2011] [error]     data = json.loads(content)
[Sun Feb 20 19:57:43 2011] [error]   File "/usr/lib64/python2.6/json/__init__.py", line 307, in loads
[Sun Feb 20 19:57:43 2011] [error]     return _default_decoder.decode(s)
[Sun Feb 20 19:57:43 2011] [error]   File "/usr/lib64/python2.6/json/decoder.py", line 319, in decode
[Sun Feb 20 19:57:43 2011] [error]     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Sun Feb 20 19:57:43 2011] [error]   File "/usr/lib64/python2.6/json/decoder.py", line 338, in raw_decode
[Sun Feb 20 19:57:43 2011] [error]     raise ValueError("No JSON object could be decoded")
[Sun Feb 20 19:57:43 2011] [error] ValueError: No JSON object could be decoded

mixedpuppy March 02, 2011

this is being caught now (line 226 in facebook_.py) but should be a part of our unit test logging.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.