Skip to content

Commit d622db0

Browse files
committed
bugzillarest: handle HTTP 400 gracefully to stop pagination
Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
1 parent dba8e07 commit d622db0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

perceval/backends/core/bugzillarest.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,18 @@ def call(self, resource, params):
459459

460460
logger.debug("Bugzilla REST client requests: %s params: %s",
461461
resource, str(params))
462-
r = self.fetch(url, payload=params, headers=headers)
462+
try:
463+
r = self.fetch(url, payload=params, headers=headers)
464+
except requests.exceptions.HTTPError as e:
465+
if e.response is not None and e.response.status_code == 400:
466+
logger.warning(
467+
"Bugzilla REST returned 400 for resource %s with params %s. "
468+
"Stopping pagination gracefully.",
469+
resource, params
470+
)
471+
return json.dumps({"bugs": []})
472+
raise
473+
463474

464475
# Check for possible Bugzilla API errors
465476
result = r.json()

0 commit comments

Comments
 (0)