diff --git a/perceval/backends/core/bugzillarest.py b/perceval/backends/core/bugzillarest.py index 18e9da0c5..e690cea81 100644 --- a/perceval/backends/core/bugzillarest.py +++ b/perceval/backends/core/bugzillarest.py @@ -459,7 +459,24 @@ def call(self, resource, params): logger.debug("Bugzilla REST client requests: %s params: %s", resource, str(params)) - r = self.fetch(url, payload=params, headers=headers) + try: + r = self.fetch(url, payload=params, headers=headers) + except requests.exceptions.HTTPError as e: + if e.response is not None and e.response.status_code == 400: + logger.warning( + "Bugzilla REST returned 400 for resource %s with params %s. " + "This usually indicates an invalid or too-large pagination offset.", + resource, params + ) + raise BackendError( + cause=( + "Bugzilla REST API returned HTTP 400 while paginating. " + "Pagination offsets may be too large or unsupported by the server." + ) + ) + raise + + # Check for possible Bugzilla API errors result = r.json() diff --git a/releases/1.4.6.md b/releases/1.4.6.md new file mode 100644 index 000000000..3dd49fa56 --- /dev/null +++ b/releases/1.4.6.md @@ -0,0 +1,3 @@ +## Bug fixes + +- BugzillaREST now raises a BackendError when the Bugzilla API returns HTTP 400 during pagination, avoiding ambiguity between empty results and request failures.