aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-11-27 03:34:27 -0500
committerRapptz <[email protected]>2015-11-27 03:34:37 -0500
commit4a32ae444a6d71f752a0ee92ab23fe34123c0108 (patch)
tree0b8b4b190a43af1cd7c93ca418e643d9bc951825
parentDocument Client.run reconnection idiosyncrasy. (diff)
downloaddiscord.py-4a32ae444a6d71f752a0ee92ab23fe34123c0108.tar.xz
discord.py-4a32ae444a6d71f752a0ee92ab23fe34123c0108.zip
Add the message to the exception output.
-rw-r--r--discord/errors.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/errors.py b/discord/errors.py
index a8450777..d105d404 100644
--- a/discord/errors.py
+++ b/discord/errors.py
@@ -68,6 +68,15 @@ class HTTPException(DiscordException):
message = httplib.responses.get(response.status_code, 'HTTP error')
message = '{0} (status code: {1.response.status_code})'.format(message, self)
+
+ try:
+ data = response.json()
+ response_error = data['message']
+ if response_error:
+ message = '{}: {}'.format(message, response_error)
+ except:
+ pass
+
super(HTTPException, self).__init__(message)
class InvalidArgument(ClientException):