Skip to content

Error handling ​

Interact reports failed requests through $server.error and pauses automatic updates. Local edits remain available.

html
<p role="alert" x-text="$server.error ? $server.error.message : ''"></p>

Ordinary actions need no .catch() callback. The persistent alert can announce changed messages. Put padding or a background on a wrapper shown only while an error exists if the empty alert should take no visual space.

Failure fields ​

error is null or { code, message, status, recovery }. A null status means no readable response was available. Recovery values are retry, reload, authenticate, or none; none performs an automatic action.

CodeMeaningRecovery
snapshot_expiredThe signed snapshot passed its lifetimeReload
session_changedThe snapshot belongs to a different sessionReload
invalid_snapshotMalformed, tampered, or wrong-scope snapshotReload
unauthenticatedAuthentication is required (401)Application sign-in flow
csrf_failedCakePHP rejected the security token (403)Reload
forbiddenCurrent access is denied (403)Application decision
upload_too_largeServer rejected an oversized upload (413)Choose a smaller file, then submit explicitly
invalid_requestUpdate input was rejected (400)Correct input, then explicitly try again
server_errorServer returned a 5xx responseVerify the outcome before another explicit attempt
http_errorAnother HTTP error statusApplication decision
network_errorFetch failed without a responseVerify the outcome before another explicit attempt
unexpected_redirectThe update redirected instead of returning its protocolReload / check application authentication handling
invalid_responseInvalid JSON, content type, envelope, identity, or root markupReload / check application logs
client_errorThe browser could not prepare or apply the updateReload / check browser diagnostics

Recovery ​

After a failure, queued actions and pending debounce timers are cancelled. For a retry failure, an explicit action, submit, or sync sends a fresh request with the current draft. It does not replay failed work. Other categories require an application decision, fresh mount, or sign-in flow.

html
<button
  type="button"
  x-show="$server.error && $server.error.recovery === 'retry'"
  @click="$server.sync()"
  :disabled="$server.busy"
>
  Synchronize draft
</button>

A failure may occur after a save completed. Verify the outcome before repeating a persistent operation. Offer a normal application reload/sign-in link where appropriate. exportDraft() supports an intentional copy step; there is no automatic browser storage or restoration.

Validation errors ​

A renderable HTTP 422 supplies $server.errors and does not pause updates. It is an accepted render rather than a request failure.

JavaScript and events ​

Inspect the RequestResult returned by call() or sync() when needed. The bubbling interact:error event contains the same failure fields and fires once per failed request, not for each blocked attempt. Removed islands do not emit new failure UI.

Server integration ​

The plugin subscribes to CakePHP's Exception.beforeRender event and returns safe versioned JSON for update exceptions after normal logging. Other routes and application-handled responses retain their handling. Custom error documents get status-based feedback; exception messages are not parsed to classify failures. Raw error pages and traces are not inserted into island HTML. See custom endpoints for route scope requirements.