Skip to content

Commit

Permalink
Change InvalidResponse to align with other errors
Browse files Browse the repository at this point in the history
Storing the message in args[0] seems more Pythonic.
  • Loading branch information
danmichaelo committed Dec 9, 2018
1 parent c98f015 commit 078cd57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mwclient/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ class NoWriteApi(MwClientError):
class InvalidResponse(MwClientError):

def __init__(self, response_text=None):
self.message = 'Did not get a valid JSON response from the server. Check that ' + \
'you used the correct hostname. If you did, the server might ' + \
'be wrongly configured or experiencing temporary problems.'
super(InvalidResponse, self).__init__(
'Did not get a valid JSON response from the server. Check that ' +
'you used the correct hostname. If you did, the server might ' +
'be wrongly configured or experiencing temporary problems.',
response_text
)
self.response_text = response_text
super(InvalidResponse, self).__init__(self.message, response_text)

def __str__(self):
return self.message
return self.args[0]


class InvalidPageTitle(MwClientError):
Expand Down

0 comments on commit 078cd57

Please sign in to comment.