As @jan said, it will iterate over the result set until it gets an exception and then just break the iteration and return the result.
If you look at the code it becomes a bit easier to see:
const allData = []
let counter = 0;
do {
try {
const items = $items("Increment", 0, counter).map(item => item.json);
allData.push.apply(allData, items);
} catch (error) {
return [{json: {allData}}];
}
counter++;
} while(true);