Hourglass.Failure (hourglass v0.6.0)

Copy Markdown View Source

Shared encoding for Temporal's ApplicationFailureInfo-flavoured Temporal.Api.Failure.V1.Failure proto.

Temporal does not distinguish an activity's application failure from a workflow's: both travel as a Failure whose failure_info oneof carries an ApplicationFailureInfo{type:, non_retryable:, details:}. This module is the one place that shape gets built, so Hourglass.ActivityRunner (activity failures, via Hourglass.Activity.RetryClassifier's verdict) and Hourglass.Workflow.Evaluator (a workflow body's own terminal failure, via Hourglass.Workflow.fail/2,3) encode it identically rather than maintaining two copies that could drift.

Summary

Types

The classifier/author-supplied shape this module encodes. details, when present, must be JSON-encodable (falls back to inspect/1 otherwise).

Functions

Build a %Temporal.Api.Failure.V1.Failure{} carrying an ApplicationFailureInfo from application_failure().

Types

application_failure()

@type application_failure() :: %{
  type: String.t(),
  message: String.t(),
  details: map() | nil,
  non_retryable: boolean()
}

The classifier/author-supplied shape this module encodes. details, when present, must be JSON-encodable (falls back to inspect/1 otherwise).

Functions

application_failure(map)

@spec application_failure(application_failure()) ::
  Temporal.Api.Failure.V1.Failure.t()

Build a %Temporal.Api.Failure.V1.Failure{} carrying an ApplicationFailureInfo from application_failure().