-module(aion@error). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/aion/error.gleam"). -export([retryable/1, retryable_with_details/2, terminal/1, terminal_with_details/2]). -export_type([activity_error/0, timeout_error/0, cancellation_error/0, non_determinism_error/0, engine_error/0, workflow_error/0, boundary_decode_error/0, receive_error/0, query_error/0, child_error/1, timeout_result_error/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Typed error taxonomy for Aion workflow authors.\n" "\n" " The `aion_flow` package models failure as data. Public fallible functions\n" " return typed `Result` errors; library code must not panic, call `todo`, or\n" " use assertions as control flow. Activity failures, decode failures, engine\n" " lifecycle failures, non-determinism, and unknown live-interaction names are\n" " all represented by the types in this module.\n" ). -type activity_error() :: {retryable, binary(), binary()} | {terminal, binary(), binary()} | {activity_decode_failed, aion@codec:decode_error()} | {activity_timed_out, timeout_error()} | {activity_cancelled, cancellation_error()} | {activity_non_deterministic, non_determinism_error()} | {activity_engine_failure, binary()}. -type timeout_error() :: {timed_out, binary()}. -type cancellation_error() :: {cancelled, binary()}. -type non_determinism_error() :: {non_determinism_violation, binary()}. -type engine_error() :: {engine_failure, binary()}. -type workflow_error() :: {workflow_engine_failure, binary()}. -type boundary_decode_error() :: {decode_failed, aion@codec:decode_error()}. -type receive_error() :: {receive_decode_failed, aion@codec:decode_error()} | {unknown_signal, binary()} | {receive_cancelled, cancellation_error()} | {receive_non_deterministic, non_determinism_error()} | {receive_engine_failure, binary()}. -type query_error() :: {query_decode_failed, aion@codec:decode_error()} | {unknown_query, binary()} | {query_timed_out, timeout_error()} | {query_not_running, binary()} | {query_handler_failed, binary()} | {query_engine_failure, binary()}. -type child_error(DOY) :: {child_workflow_failed, DOY} | {child_output_decode_failed, aion@codec:decode_error()} | {child_error_decode_failed, aion@codec:decode_error()} | {child_engine_failure, binary()}. -type timeout_result_error(DOZ) :: {timed_out_error, timeout_error()} | {inner_error, DOZ} | {timeout_engine_failure, binary()}. -file("src/aion/error.gleam", 37). ?DOC(" Construct a retryable activity failure with no detail payload.\n"). -spec retryable(binary()) -> activity_error(). retryable(Message) -> {retryable, Message, <<""/utf8>>}. -file("src/aion/error.gleam", 42). ?DOC(" Construct a retryable activity failure with an encoded detail payload.\n"). -spec retryable_with_details(binary(), binary()) -> activity_error(). retryable_with_details(Message, Details) -> {retryable, Message, Details}. -file("src/aion/error.gleam", 50). ?DOC(" Construct a terminal activity failure with no detail payload.\n"). -spec terminal(binary()) -> activity_error(). terminal(Message) -> {terminal, Message, <<""/utf8>>}. -file("src/aion/error.gleam", 55). ?DOC(" Construct a terminal activity failure with an encoded detail payload.\n"). -spec terminal_with_details(binary(), binary()) -> activity_error(). terminal_with_details(Message, Details) -> {terminal, Message, Details}.