File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,9 @@ def iter_pages(self: SyncPageT) -> Iterator[SyncPageT]:
104104 def get_next_page (self : SyncPageT ) -> SyncPageT :
105105 next_params = self .next_page_params ()
106106 if not next_params :
107- raise StopIteration ()
107+ raise RuntimeError (
108+ "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`."
109+ )
108110
109111 options = self ._options .copy ()
110112 options .params = {** options .params , ** next_params }
@@ -177,7 +179,9 @@ async def iter_pages(self: AsyncPageT) -> AsyncIterator[AsyncPageT]:
177179 async def get_next_page (self : AsyncPageT ) -> AsyncPageT :
178180 next_params = self .next_page_params ()
179181 if not next_params :
180- raise StopIteration ()
182+ raise RuntimeError (
183+ "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`."
184+ )
181185
182186 options = self ._options .copy ()
183187 options .params = {** options .params , ** next_params }
You can’t perform that action at this time.
0 commit comments