Urgent fixes needed - exception handler in _get in gwibber/microblog/twitter.py
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gwibber |
Fix Released
|
Undecided
|
Unassigned | ||
gwibber (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: gwibber
Hi,
This is with reference to http://
The exception handler in _get() in twitter.py (try/except block at lines 131-138) seems to be receiving unforeseen/
Errors that seem to end up in this handler:
Error 1. Twitter authentication failure (original purpose of the handler).
Error 2. Unsupported locale setting - see https:/
Error 3. Network-related problems (DNS failure, failure to connect to Twitter/retrieve JSON) - see https:/
When each of these errors occurs, the "data" variable has a different data type:
Error 1 (auth failure): dictionary with single item whose key is "errors" (not "error" - see https:/
Error 2 (locale problem): a _list_ containing multiple dictionaries (timeline or other valid data received from Twitter).
Error 3 (network/DNS): str.
Effects of current code:
For Errors 2 and 3, the _if data.has_
For Error 1, the auth failure is not detected and the GwibberProtocol
Ideas/suggestions:
Network/DNS problems are going to happen. A small notification (an icon or tooltip) to warn the user that no (new) messages are displayed because of network problems will help improve usability. For that, the corresponding error has to be trapped here, and a useful exception raised that can be handled by GUI code.
The auth failure can be handled by changing the sought key from "error" to "errors", and perhaps introducing another check before _if data.has_
The locale problem may take a while to work out (sorry, no ideas about that) but in the interim, may I please ask that the except line assign the exception to a variable, as in https:/
I hope one of the developers will please pay attention to this area soon, because multiple bug reports with apparently different root causes are being submitted with the AttributeError stack trace, and this is bound to be confusing to people trying to help other users with bugs, or trying to triage bugs, especially if they are not familiar with the code.
Thank you for your urgent consideration of this issue,
Ed.
description: | updated |
Changed in gwibber: | |
status: | New → Fix Committed |
Changed in gwibber (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Triaged |
https:/ /bugs.launchpad .net/ubuntu/ +source/ gwibber/ +bug/530195/ comments/ 72 looks like it addresses at least some of the issues mentioned in this bug. Please consider the patch for testing and inclusion into trunk.
Thanks,
Ed.