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

Commit 19abd85

Browse files
Neil Jerramdims
authored andcommitted
Fix exception signature
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.
1 parent 483a37e commit 19abd85

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

etcd3gw/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def post(self, *args, **kwargs):
8383
if resp.status_code in _EXCEPTIONS_BY_CODE:
8484
raise _EXCEPTIONS_BY_CODE[resp.status_code](resp.reason)
8585
if resp.status_code != requests.codes['ok']:
86-
raise exceptions.Etcd3Exception(resp.reason, resp.text)
86+
raise exceptions.Etcd3Exception(resp.text, resp.reason)
8787
except requests.exceptions.Timeout as ex:
8888
raise exceptions.ConnectionTimeoutError(six.text_type(ex))
8989
except requests.exceptions.ConnectionError as ex:

etcd3gw/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313

1414
class Etcd3Exception(Exception):
15-
def __init__(self, msg, detail_text=None):
16-
super(Etcd3Exception, self).__init__(msg)
15+
def __init__(self, detail_text=None, *args):
16+
super(Etcd3Exception, self).__init__(*args)
1717
self.detail_text = detail_text
1818

1919

0 commit comments

Comments
 (0)