Skip to content

Commit c37708d

Browse files
authored
Handle exceptions in bugzilla.logged_in (#784)
1 parent 070b535 commit c37708d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jbi/services/bugzilla.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def _call(self, verb, url, *args, **kwargs):
6868
def logged_in(self) -> bool:
6969
"""Verify the API key validity."""
7070
# https://bugzilla.readthedocs.io/en/latest/api/core/v1/user.html#who-am-i
71-
resp = self._call("GET", f"{self.base_url}/rest/whoami")
71+
try:
72+
resp = self._call("GET", f"{self.base_url}/rest/whoami")
73+
except (requests.HTTPError, BugzillaClientError):
74+
return False
7275
return "id" in resp
7376

7477
@instrumented_method

0 commit comments

Comments
 (0)