Skip to content

Commit 562ab2c

Browse files
committed
bugzillarest: raise error on HTTP 400 during pagination
Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
1 parent dba8e07 commit 562ab2c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

perceval/backends/core/bugzillarest.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,24 @@ 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+
"This usually indicates an invalid or too-large pagination offset.",
469+
resource, params
470+
)
471+
raise BackendError(
472+
cause=(
473+
"Bugzilla REST API returned HTTP 400 while paginating. "
474+
"Pagination offsets may be too large or unsupported by the server."
475+
)
476+
)
477+
raise
478+
479+
463480

464481
# Check for possible Bugzilla API errors
465482
result = r.json()

releases/1.4.6.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Bug fixes
2+
3+
- BugzillaREST now raises a BackendError when the Bugzilla API returns HTTP 400 during pagination, avoiding ambiguity between empty results and request failures.

0 commit comments

Comments
 (0)