Skip to content

Commit 924a0eb

Browse files
committed
adding else after raise
1 parent 3a26633 commit 924a0eb

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

splunklib/binding.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ def _handle_auth_error(msg):
235235
except HTTPError as he:
236236
if he.status == 401:
237237
raise AuthenticationError(msg, he)
238-
raise
238+
else:
239+
raise
239240

240241

241242
def _authentication(request_fun):
@@ -302,7 +303,8 @@ def wrapper(self, *args, **kwargs):
302303
elif he.status == 401 and not self.autologin:
303304
raise AuthenticationError(
304305
"Request failed: Session is not logged in.", he)
305-
raise
306+
else:
307+
raise
306308

307309
return wrapper
308310

@@ -921,7 +923,8 @@ def login(self):
921923
except HTTPError as he:
922924
if he.status == 401:
923925
raise AuthenticationError("Login failed.", he)
924-
raise
926+
else:
927+
raise
925928

926929
def logout(self):
927930
"""Forgets the current session token, and cookies."""
@@ -1299,8 +1302,9 @@ def request(self, url, message, **kwargs):
12991302
except Exception:
13001303
if self.retries <= 0:
13011304
raise
1302-
time.sleep(self.retryDelay)
1303-
self.retries -= 1
1305+
else:
1306+
time.sleep(self.retryDelay)
1307+
self.retries -= 1
13041308
response = record(response)
13051309
if 400 <= response.status:
13061310
raise HTTPError(response)

splunklib/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,8 @@ def __getitem__(self, key):
12721272
except HTTPError as he:
12731273
if he.status == 404: # No entity matching key and namespace.
12741274
raise KeyError(key)
1275-
raise
1275+
else:
1276+
raise
12761277

12771278
def __iter__(self, **kwargs):
12781279
"""Iterate over the entities in the collection.
@@ -1634,7 +1635,8 @@ def delete(self, name, **params):
16341635
# KeyError.
16351636
if he.status == 404:
16361637
raise KeyError(f"No such entity {name}")
1637-
raise
1638+
else:
1639+
raise
16381640
return self
16391641

16401642
def get(self, name="", owner=None, app=None, sharing=None, **query):
@@ -2228,7 +2230,8 @@ def __getitem__(self, key):
22282230
except HTTPError as he:
22292231
if he.status == 404: # No entity matching kind and key
22302232
raise KeyError((key, kind))
2231-
raise
2233+
else:
2234+
raise
22322235
else:
22332236
# Iterate over all the kinds looking for matches.
22342237
kind = None

splunklib/results.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ def _parse_results(self, stream):
268268
# splunk that is described in __init__.
269269
if 'no element found' in pe.msg:
270270
return
271-
raise
271+
else:
272+
raise
272273

273274

274275
class JSONResultsReader:

0 commit comments

Comments
 (0)