How to determine the end of pagination?

How to determine the end of pagination?

Hi,
I'm wondering how to judge the end of pagination. I learnt from Zoho CRM API that we can iterate to fetch all data in a table like:
Iteration 1:  fromIndex=1&toIndex=200
Iteration 2:  fromIndex=201&toIndex=400
.....
However, how do I determine which iteration do I get the last page? Until I get an error code?
Is there any better way to check it?

Thanks.