Temporalex.Failure (Temporalex v0.4.2)

Copy Markdown View Source

Helpers for constructing structured Temporal failures.

Summary

Functions

Build an application failure.

Raise an application failure.

Build a cancellation failure.

Normalize a failure for encoding: wrap scalar details (and last_heartbeat_details) into lists and normalize the cause chain.

Functions

application(message, opts \\ [])

Build an application failure.

:type is the stable string matched by Temporal retry policies. :retryable? defaults to true and is inverted when encoded to Temporal's non_retryable wire field.

application!(message, opts \\ [])

@spec application!(
  term(),
  keyword()
) :: no_return()

Raise an application failure.

cancelled(message \\ "cancelled", opts \\ [])

Build a cancellation failure.

normalize(failure)

Normalize a failure for encoding: wrap scalar details (and last_heartbeat_details) into lists and normalize the cause chain.

The NIF's typed encoder requires payload lists; the constructors in this module already guarantee that, but failures built as struct literals (raise %ApplicationError{details: %{...}}) may carry scalars. Applied at the encode boundaries so user code never has to remember.