Skip to content

Commit 1c998a1

Browse files
authored
refactor: rename error_on_execution to catch_errors_as_events (#583)
Closes #581 The old name read as "error on execution" (describing a problem) rather than conveying the behavior it controls. The new name says exactly what it does: catch errors and dispatch them as `error.execution` events. Renamed across source code, engine, SCXML actions, all tests, all docs, and AGENTS.md.
1 parent 2d7a551 commit 1c998a1

32 files changed

Lines changed: 112 additions & 112 deletions

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ The engine follows the SCXML run-to-completion (RTC) model with two processing l
4141
- `send()`**external queue** (processed after current macrostep ends).
4242
- `raise_()`**internal queue** (processed within the current macrostep, before external events).
4343

44-
### Error handling (`error_on_execution`)
44+
### Error handling (`catch_errors_as_events`)
4545

46-
- `StateChart` has `error_on_execution=True` by default; `StateMachine` has `False`.
46+
- `StateChart` has `catch_errors_as_events=True` by default; `StateMachine` has `False`.
4747
- Errors are caught at the **block level** (per onentry/onexit/transition `on` block), not per
4848
microstep. This means `after` callbacks still run even when an action raises — making
4949
`after_<event>()` a natural **finalize** hook (runs on both success and failure paths).

docs/actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The `state` column shows what the `state` parameter resolves to when
6969

7070
```{tip}
7171
`after` callbacks run even when an earlier group raises and
72-
`error_on_execution` is enabled — making them a natural **finalize** hook.
72+
`catch_errors_as_events` is enabled — making them a natural **finalize** hook.
7373
See {ref}`error-handling-cleanup-finalize` for the full pattern.
7474
```
7575

docs/async.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ processing loop. Events triggered from within callbacks (via `send()` or
161161
are enqueued and processed within the current macrostep.
162162
```
163163

164-
If an exception occurs during processing (with `error_on_execution=False`),
164+
If an exception occurs during processing (with `catch_errors_as_events=False`),
165165
the exception is routed to the caller whose event caused it. Other callers
166166
whose events were still pending will also receive the exception, since the
167167
processing loop clears the queue on failure.

docs/behaviour.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SCXML-compliant behavior provides more predictable semantics.
3333
| `allow_event_without_transition` | `True` | `False` | Tolerate events that don't match any transition |
3434
| `enable_self_transition_entries` | `True` | `False` | Execute entry/exit actions on self-transitions |
3535
| `atomic_configuration_update` | `False` | `True` | When to update {ref}`configuration <querying-configuration>` during a microstep |
36-
| `error_on_execution` | `True` | `False` | Catch action errors as `error.execution` events |
36+
| `catch_errors_as_events` | `True` | `False` | Catch action errors as `error.execution` events |
3737

3838
Each attribute is described below, with cross-references to the pages that
3939
cover the topic in depth.
@@ -142,7 +142,7 @@ in callbacks.
142142
```
143143

144144

145-
## `error_on_execution`
145+
## `catch_errors_as_events`
146146

147147
When `True` (SCXML default), runtime exceptions in action callbacks
148148
(entry/exit, transition `on`) are caught by the engine and dispatched as
@@ -152,7 +152,7 @@ propagate normally to the caller.
152152
```{note}
153153
{ref}`Validators <validators>` are **not** affected by this flag — they
154154
always propagate exceptions to the caller, regardless of the
155-
`error_on_execution` setting. See {ref}`validators` for details.
155+
`catch_errors_as_events` setting. See {ref}`validators` for details.
156156
```
157157

158158
```{seealso}
@@ -168,7 +168,7 @@ adopt SCXML semantics incrementally in an existing `StateMachine`:
168168

169169
```python
170170
class MyMachine(StateMachine):
171-
error_on_execution = True
171+
catch_errors_as_events = True
172172
# ... everything else behaves as before ...
173173
```
174174

docs/error_handling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ failures by transitioning to an error state, retrying, or recovering. This
1515
follows the [SCXML error handling specification](https://www.w3.org/TR/scxml/#errorsAndEvents).
1616

1717
```{tip}
18-
`error_on_execution` is a class attribute that controls this behavior.
18+
`catch_errors_as_events` is a class attribute that controls this behavior.
1919
`StateChart` uses `True` by default (SCXML-compliant); set it to `False`
2020
to let exceptions propagate to the caller instead. See {ref}`behaviour`
2121
for the full comparison of behavioral attributes and how to customize them.
@@ -226,7 +226,7 @@ more detailed version of this pattern with annotated output.
226226
{ref}`Validators <validators>` operate in the **transition-selection** phase,
227227
before any state changes occur. Their exceptions **always propagate** to the
228228
caller — they are never caught by the engine and never converted to
229-
`error.execution` events, regardless of the `error_on_execution` setting.
229+
`error.execution` events, regardless of the `catch_errors_as_events` setting.
230230

231231
This is intentional: a validator rejection means the transition should not
232232
happen at all. It is semantically equivalent to a condition returning
@@ -240,7 +240,7 @@ propagation.
240240

241241
```{seealso}
242242
See {ref}`behaviour` for the full comparison of behavioral attributes
243-
and how to customize `error_on_execution` and other settings.
243+
and how to customize `catch_errors_as_events` and other settings.
244244
See {ref}`actions` for the callback execution order within each
245245
microstep.
246246
```

docs/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ on a non-final state raises `InvalidDefinition`.
305305
### `error.execution` events
306306

307307
When a callback raises during a macrostep and
308-
{ref}`error_on_execution <behaviour>` is enabled, the engine dispatches an
308+
{ref}`catch_errors_as_events <behaviour>` is enabled, the engine dispatches an
309309
`error.execution` internal event. Define a transition for this event to
310310
recover from errors within the statechart:
311311

docs/guards.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ True
293293
### Validators always propagate
294294

295295
Validator exceptions **always propagate** to the caller, regardless of the
296-
`error_on_execution` flag. This is intentional: validators operate in the
296+
`catch_errors_as_events` flag. This is intentional: validators operate in the
297297
**transition-selection** phase, not the execution phase. A validator that
298298
rejects is semantically equivalent to a condition that returns `False`
299299
the transition simply should not happen. The difference is that the
300300
validator communicates the reason via an exception.
301301

302-
This means that even when `error_on_execution = True` (the default for
302+
This means that even when `catch_errors_as_events = True` (the default for
303303
`StateChart`):
304304

305305
- Validator exceptions are **not** converted to `error.execution` events.

docs/invoke.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ True
343343
## Error handling
344344

345345
If an invoke handler raises an exception, `error.execution` is sent to the machine's
346-
internal queue (when `error_on_execution=True`, the default for `StateChart`). You can
346+
internal queue (when `catch_errors_as_events=True`, the default for `StateChart`). You can
347347
handle it with a transition for `error.execution`:
348348

349349
```py

docs/processing_model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ callback groups defined in the {ref}`execution order <actions>`:
4747
8. **After** — run post-transition callbacks (always runs, even on error).
4848

4949
```{tip}
50-
If an error occurs during steps 3–6 and `error_on_execution` is enabled,
50+
If an error occurs during steps 3–6 and `catch_errors_as_events` is enabled,
5151
the error is caught at the **block level** — remaining actions in that block
5252
are skipped, but the microstep continues. See
5353
{ref}`error-execution` and the

docs/releases/3.0.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Existing calls to `send()` are fully backward compatible.
293293

294294
### Error handling with `error.execution`
295295

296-
When `error_on_execution` is enabled (default in `StateChart`), runtime exceptions during
296+
When `catch_errors_as_events` is enabled (default in `StateChart`), runtime exceptions during
297297
transitions are caught and result in an internal `error.execution` event. This follows
298298
the [SCXML error handling specification](https://www.w3.org/TR/scxml/#errorsAndEvents).
299299

@@ -458,7 +458,7 @@ machines can receive context at creation time:
458458
#### `StateChart` base class
459459

460460
The new `StateChart` class is the recommended base for all new state machines. It enables
461-
SCXML-compliant defaults: `error_on_execution`, `enable_self_transition_entries`, and
461+
SCXML-compliant defaults: `catch_errors_as_events`, `enable_self_transition_entries`, and
462462
non-atomic configuration updates. The existing `StateMachine` class is now a subclass with
463463
backward-compatible defaults. See {ref}`behaviour` for a comparison table.
464464

0 commit comments

Comments
 (0)