From dc06ffeda69be44a5d4e68018952921d21cc32ad Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Mon, 30 May 2022 15:33:19 -0400 Subject: [PATCH] Bump --- lithic/_base_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lithic/_base_client.py b/lithic/_base_client.py index 702a4a71..f0e22d07 100644 --- a/lithic/_base_client.py +++ b/lithic/_base_client.py @@ -104,7 +104,9 @@ def iter_pages(self: SyncPageT) -> Iterator[SyncPageT]: def get_next_page(self: SyncPageT) -> SyncPageT: next_params = self.next_page_params() if not next_params: - raise StopIteration() + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) options = self._options.copy() options.params = {**options.params, **next_params} @@ -177,7 +179,9 @@ async def iter_pages(self: AsyncPageT) -> AsyncIterator[AsyncPageT]: async def get_next_page(self: AsyncPageT) -> AsyncPageT: next_params = self.next_page_params() if not next_params: - raise StopIteration() + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) options = self._options.copy() options.params = {**options.params, **next_params}