PEP8 Cleanup, More Verbosness #62
No reviewers
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "pep8_and_verboseness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
other apps have "AuthError", etc. for some reason.
I'll merge this, as I think the Exception name changes are good, but the README (at the very least) should be updated to note that this changed. I'll probably do a larger release with these changes so it's evident that... well, something public-facing changed.
Just wanted to let you know that the Exceptions names WERE changed without a version bump or README update. :P
Why does Twython create it's own errors such as TwythonError?
Many reusable errors are already defined in Python (http://docs.python.org/library/exceptions.html), so reusing those would be a good start.
Also, many exceptions are caught and then rethrown, which makes it much harder to debug issues. For example, in line 338:
the Twython error masks the RequestException. In the stacktrace, it would have been clear that bulkUserLookup() threw the error, so information was actually lost!
It's nice to know the error was brought up in the class, also; it's kind of just common practice
requestsor any other library.I always look at the stack trace to see where the error comes from; that way you can see where the error originally came from and also inspect values higher up in the stack (if you're using a debugger)
TwythonErrorcould (and possibly should) be used for errors related to anything Twython-ish. There's any number of things that we could possibly want to catch and explicitly message about, which is why they exist. The code you've provided will throw an HTTP response error code if something's wrong - if not, chances arerequestswon't work anyway and you'll know that well before this point.One way to meet in the middle on this issue would be to throw the rest of the stack trace with TwythonError - I'm open to a patch for this.