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