runContainedSubmit function
The TUI submit boundary's containment (gh-1787): runs body and
reports any throw through report — never rethrows. One choke point at
_handleTuiSubmit: every settings flow reachable from a submit inherits
the guard, a failed flow renders the clean one-line error panel
(validate-first writes leave the config untouched — nothing to roll
back), and the session stays usable.
Implementation
Future<void> runContainedSubmit(
Future<void> Function() body,
void Function(Object error) report,
) async {
try {
await body();
} on Object catch (error) {
report(error);
}
}