From: Michael Tremer Date: Wed, 28 Jun 2023 11:07:15 +0000 (+0000) Subject: bugzilla: Catch 404 when a user does not exist X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0502fb3317b67fb37ee403893fabd29bd3b2d77;p=ipfire.org.git bugzilla: Catch 404 when a user does not exist Signed-off-by: Michael Tremer --- diff --git a/src/backend/bugzilla.py b/src/backend/bugzilla.py index 0680bca3..3e494ef0 100644 --- a/src/backend/bugzilla.py +++ b/src/backend/bugzilla.py @@ -3,6 +3,7 @@ import json import urllib.parse +from . import httpclient from . import misc from .decorators import * @@ -91,7 +92,15 @@ class Bugzilla(misc.Object): """ Fetches a user from Bugzilla """ - response = await self._request("GET", "/rest/user/%s" % uid) + try: + response = await self._request("GET", "/rest/user/%s" % uid) + + # Return nothing if the user could not be found + except httpclient.HTTPError as e: + if e.code == 404: + return + + raise e # Return the user object for data in response.get("users"):