From 3874579bac22a6648e774995478cb597689d89bc Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 27 Oct 2022 12:56:10 -0500 Subject: [PATCH] Improve exceptions raised for unknown method return types for pagination --- tweepy/asynchronous/pagination.py | 5 +++-- tweepy/pagination.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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") -- 2.25.1