Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
fix: Revert "fix: stream error handling (#2054)" (#2064)
Browse files Browse the repository at this point in the history
This reverts commit e81f636.
  • Loading branch information
lucasmarshall authored Dec 13, 2023
1 parent a219242 commit 71efd96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/remotes/utils/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function paginator<T>(
response = await pageFetcher(cursor);
} catch (e: any) {
if (e.problemType === 'SG_TERMINAL_TOO_MANY_REQUESTS_ERROR') {
passThrough.destroy(e);
passThrough.emit('error', e);
return;
}
throw e;
Expand All @@ -72,13 +72,13 @@ export async function paginator<T>(
cursor = getNextCursorFromPage(response);

readable.pipe(passThrough, { end: index === lastIndex && !cursor });
readable.on('error', (err) => passThrough.destroy(err));
readable.on('error', (err) => passThrough.emit('error', err));

await new Promise((resolve) => readable.on('end', resolve));
} while (cursor);
}
})().catch((err) => {
passThrough.destroy(err);
passThrough.emit('error', err);
});

return passThrough;
Expand Down

0 comments on commit 71efd96

Please sign in to comment.