Skip to main content

Module failure

Module failure 

Expand description

A failure as recorded: what a failed attempt, step, update, object call or workflow carries, in every SDK.

The journal stores a failure’s payload as bytes; the envelope is JSON, with absent fields left out:

{"message":"card declined","type":"CardDeclined","code":"card_declined",
 "details":{"last4":"4242"},"retryable":false,"stack":"...","cause":null}

A payload that is not an envelope (text recorded by an older writer, or by fail(token, "reason")) reads as a failure with that message.

A step function’s error is anything that converts into a Failure: every std::error::Error does, keeping its type name and its source chain, and Fusee’s own Error keeps the failure it carries. To mark a failure as final, or to give it a code or details, return a Failure directly:

use fusee::Failure;
return Err(Failure::fatal("card declined")
    .code("card_declined")
    .details(serde_json::json!({ "last4": "4242" })));

Structs§

Failure
A failure, as recorded and as returned to callers. One pointer wide (the fields are boxed), so a Result that may carry one stays small; it reads as its FailureData.
FailureData
The fields of a Failure.

Constants§

STACK_LIMIT
Stacks longer than this are cut (on a character boundary).

Traits§

IntoFailure
What a step function’s error becomes when it is recorded.