From: Harmon Date: Thu, 27 Oct 2022 17:56:10 +0000 (-0500) Subject: Improve exceptions raised for unknown method return types for pagination X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3874579bac22a6648e774995478cb597689d89bc;p=tweepy.git Improve exceptions raised for unknown method return types for pagination --- diff --git a/tweepy/asynchronous/pagination.py b/tweepy/asynchronous/pagination.py index 6743e0b..bd2d9c1 100644 --- a/tweepy/asynchronous/pagination.py +++ b/tweepy/asynchronous/pagination.py @@ -128,8 +128,9 @@ class AsyncPaginationIterator: elif isinstance(response, aiohttp.ClientResponse): meta = (await response.json()).get("meta", {}) else: - raise NotImplementedError( - f"Unknown {type(response)} return type for {self.method}" + raise RuntimeError( + f"Unknown {type(response)} return type for " + f"{self.method.__qualname__}" ) self.previous_token = meta.get("previous_token") diff --git a/tweepy/pagination.py b/tweepy/pagination.py index cdf429d..b30c9e6 100644 --- a/tweepy/pagination.py +++ b/tweepy/pagination.py @@ -124,8 +124,9 @@ class PaginationIterator: elif isinstance(response, requests.Response): meta = response.json().get("meta", {}) else: - raise NotImplementedError( - f"Unknown {type(response)} return type for {self.method}" + raise RuntimeError( + f"Unknown {type(response)} return type for " + f"{self.method.__qualname__}" ) self.previous_token = meta.get("previous_token")