Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Fix exception signature
Browse files Browse the repository at this point in the history
I previously extended the Etcd3Exception constructor signature such
that it was no longer possible for the derived exception types to
construct with no args.  This change makes that possible again, while
still allowing an Etcd3Exception to be constructed with detail text as
well as the traditional "Bad Request" message.
  • Loading branch information
Neil Jerram authored and dims committed Sep 18, 2019
1 parent 483a37e commit 19abd85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion etcd3gw/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def post(self, *args, **kwargs):
if resp.status_code in _EXCEPTIONS_BY_CODE:
raise _EXCEPTIONS_BY_CODE[resp.status_code](resp.reason)
if resp.status_code != requests.codes['ok']:
raise exceptions.Etcd3Exception(resp.reason, resp.text)
raise exceptions.Etcd3Exception(resp.text, resp.reason)
except requests.exceptions.Timeout as ex:
raise exceptions.ConnectionTimeoutError(six.text_type(ex))
except requests.exceptions.ConnectionError as ex:
Expand Down
4 changes: 2 additions & 2 deletions etcd3gw/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@


class Etcd3Exception(Exception):
def __init__(self, msg, detail_text=None):
super(Etcd3Exception, self).__init__(msg)
def __init__(self, detail_text=None, *args):
super(Etcd3Exception, self).__init__(*args)
self.detail_text = detail_text


Expand Down

0 comments on commit 19abd85

Please sign in to comment.