Commit | Line | Data |
---|---|---|
5531923e LP |
1 | import json |
2 | ||
3 | from twitter.util import printNicely | |
4 | ||
5 | from .colors import magenta | |
6 | ||
7 | ||
8 | def printTwitterErrors(twitterException): | |
9 | try: | |
10 | loadedJson = json.loads(twitterException.response_data) | |
11 | for m in loadedJson.get('errors', dict()): | |
12 | printNicely( | |
13 | magenta("Error " + str(m.get('code')) + ": " + m.get('message'))) | |
14 | except ValueError: | |
15 | printNicely( | |
16 | magenta( "Error: " + twitterException.response_data)) |