Skip to main content

Actions, errors, and concurrency

Handle service failures and keep asynchronous work owned by the correct screen.

Before you start: Call your app.

Reachable action names must be registered before session creation. Payloads and results are validated by the host contract. The app supplies authentication, networking, and storage.

Handle an action error​

Use a local status field to show success or a recoverable error. The mock action returns its input for valid arguments.

<Column state="{status:'Ready'}" class="p-4 gap-3">
<Button title="Save name" on-press="try call account.save with {name:'Sam'} into result; set status to 'Saved ' + result.name catch failure set status to failure.message end" />
<Text bind-text="status" />
</Column>
Handle an action error
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Pass {name:42} to see a type failure handled by catch; restore a string afterward.

Asynchronous work​

on-press drops duplicate invocations while running. .latest supersedes the previous invocation for that element/event. A .busy companion names a local boolean initialized false; the runtime owns its writes. Cancellation skips catch and rejects stale continuation effects; a remote write may already have committed. See events and concurrency.

navigate and present ask the host to open routes. emit forwards explicit output. Register navigation and check authorization in the host. Integration guides show where to register services and how long to retain sessions.