Skip to main content
On the Effect API, failures are values in the error channel. A handler’s errors are inferred from what it yields, recorded on the piece, and handled with Effect.catchTag like any other Effect.

Typed failures in handlers

Define your failures with Schema.TaggedError and fail with yield*:
src/tracker.ts
An action that yields tracker.move without handling it can fail with TaskLocked. So can a generator that runs return yield* new TaskLocked({ id }).

What a failure does

A failure you don’t handle, or a defect, fails the piece. Its details stay in your process: the SDK answers Reintersect with a generic message, such as Action "move" failed., and nothing from your error’s fields.

Turn a failure into an answer

When the member should know what went wrong, catch the failure and return a result. In an action, that’s a notice, and the block keeps its state:
src/moveTask.ts
Use fieldErrors for form validation the schema can’t express, and Effect.catchTags to handle several tags at once. In a command or message action, return a notice in the same way. A danger or warning notice on its own ends the run as failed and shows your text on the failure card.

Errors from the client

The client’s methods put the Reintersect API’s errors in the error channel, so they show up in your handler’s type until you handle them:
Each method’s error union is exported from @reintersect/sdk/effect, such as ReintersectBlocksUpdateError. A union holds:
  • The endpoint’s API errors, such as ReintersectAppBlockVersionConflictError, ReintersectAppBlockNotFoundError or ReintersectAppInteractionExpiredError. The error reference lists every tag with its status and fields.
  • Transport errors: ReintersectSdkNetworkError, ReintersectSdkTimeoutError, ReintersectSdkInvalidResponseError and ReintersectSdkInvalidInputError.
  • Token errors, when the client mints its own install token: ReintersectAppInstallTokenError, ReintersectAppConfigurationError, ReintersectAppInstallNotFoundError, ReintersectAppInstallRevokedError and ReintersectApiRateLimitExceededError.
Block state is checked on both sides. State you pass that doesn’t match the block’s schema fails with ReintersectSdkInvalidInputError before any request, and state that comes back without decoding fails with ReintersectSdkInvalidResponseError. Reads (get, query and revalidate) are retried twice with jittered backoff on network errors, timeouts and 503. Writes run once. To retry a write, compose Effect.retry with a bounded, jittered schedule yourself, and only where running it twice is safe, such as an update with expectedVersion.

Errors in a delivery

These errors describe a delivery that the SDK couldn’t run. They’re exported from @reintersect/sdk/effect/app and become the delivery’s response. They aren’t in your handlers’ error channels. The testing kit raises its own tagged errors, such as ReintersectTestControlMissingError, so a test can assert on a failure.