Skip to content

Let BREAK and CONTINUE work in a WHILE loop run asynchronously - #2701

Merged
mathiasrw merged 1 commit into
developfrom
fix/while-break-async
Oct 20, 2026
Merged

mathiasrw merged 1 commit into
developfrom
fix/while-break-async

Conversation

@mathiasrw

Copy link
Copy Markdown
Member

BREAK and CONTINUE (from #2263) throw an exception that the WHILE loop catches, but only in its synchronous path. Run with alasql.promise (or a callback), the exception escaped from a setTimeout and ended the Node process:

await alasql.promise(
	'DECLARE @i INT; SET @i = 0; WHILE @i < 10 BEGIN SET @i = @i + 1; IF @i = 3 BREAK; END; SELECT @i AS i'
);
// was: uncaught Exception [Error]: BREAK, process exits

The asynchronous loop now catches them the same way: BREAK ends the loop and CONTINUE starts the next round. The results match the synchronous run (test/test2263-B.js); test37 still passes.

Found while reviewing #2263.

@mathiasrw mathiasrw added this to the v4.x Focus milestone Oct 20, 2026
@mathiasrw
mathiasrw merged commit 078b9e8 into develop Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant