ctx.exitAll()
Terminates the current event flow and all subsequent event flows triggered in the same event dispatch. It is commonly used when all event flows under the current event need to be aborted immediately due to a global error or permission validation failure.
Use Cases
ctx.exitAll() is generally used in JS-executable contexts where it is necessary to simultaneously abort the current event flow and subsequent event flows triggered by that event:
ctx.exit()/ctx.exitAll()— Both calls stop the current step and skip the remaining flows in the same sequential event dispatch. Flows already running in parallel continue.
Type Definition
Calling ctx.exitAll() throws an internal FlowExitAllException, which is caught by the FlowEngine to stop the current event flow instance and subsequent event flows under the same event. Once called, the remaining statements in the current JS code will not be executed.
Execution Mode
- Sequential Execution: Event flows under the same event are executed in order. After any event flow calls
ctx.exitAll(), subsequent event flows will not execute. - Parallel Execution: Event flows under the same event are executed in parallel. Calling
ctx.exitAll()in one event flow will not interrupt other concurrent event flows (as they are independent).
Examples
Terminate all event flows when permission validation fails
Terminate when global pre-validation fails
Prompt before terminating
Notes
- After calling
ctx.exitAll(), subsequent code in the current JS will not execute. It is recommended to explain the reason to the user viactx.message,ctx.notification, or a modal before calling it. - Business code usually does not need to catch
FlowExitAllException; let the FlowEngine handle it. - In parallel mode,
ctx.exitAll()only terminates the current event flow and does not interrupt other concurrent event flows.
Related
- ctx.exit()
- ctx.message: Message prompts
- ctx.modal: Confirmation modal

