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.
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:
| Scenario | Description |
|---|---|
| Event Flow | Main event flow validation fails (e.g., insufficient permissions), requiring the termination of the main flow and any subsequent flows under the same event that have not yet executed. |
| Linkage Rules | When linkage validation fails, the current linkage and subsequent linkages triggered by the same event must be terminated. |
| Action Events | Pre-action validation fails (e.g., permission check before deletion), requiring the prevention of the main action and subsequent steps. |
Difference from
ctx.exit():ctx.exit()only terminates the current event flow;ctx.exitAll()terminates the current event flow and any unexecuted subsequent event flows in the same event dispatch.
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.
| Method | Scope |
|---|---|
ctx.exit() | Only terminates the current event flow; subsequent event flows are unaffected. |
ctx.exitAll() | Terminates the current event flow and aborts subsequent event flows executed sequentially under the same event. |
ctx.exitAll(), subsequent event flows will not execute.ctx.exitAll() in one event flow will not interrupt other concurrent event flows (as they are independent).ctx.exitAll(), subsequent code in the current JS will not execute. It is recommended to explain the reason to the user via ctx.message, ctx.notification, or a modal before calling it.FlowExitAllException; let the FlowEngine handle it.ctx.exit().ctx.exitAll() only terminates the current event flow and does not interrupt other concurrent event flows.