HTTPException now has a text attribute if JSON is not available.

This commit is contained in:
Rapptz
2016-01-25 01:16:14 -05:00
parent 8caadb5f03
commit 4d816c4ef3
2 changed files with 17 additions and 6 deletions

View File

@ -54,10 +54,15 @@ class HTTPException(DiscordException):
instance of `aiohttp.ClientResponse`__.
__ http://aiohttp.readthedocs.org/en/stable/client_reference.html#aiohttp.ClientResponse
.. attribute:: text
The text of the response if it wasn't JSON. Could be None.
"""
def __init__(self, response, message=None):
def __init__(self, response, message=None, text=None):
self.response = response
self.text = text
fmt = '{0.reason} (status code: {0.status})'
if message: