Skip to main content

ENGINE_FAILURE

Constant ENGINE_FAILURE 

Source
pub const ENGINE_FAILURE: &str = "// EngineFailure: typed runtime/engine failure for workflow-style machines.\n//\n// Corsac and other workflow runtimes use Gust as the contract language for\n// compiled workflows. They need a stable, typed failure surface so that\n// retry policies, replay semantics, and observability can reason about\n// failures without parsing strings.\n//\n// This file ships as `gust_stdlib::ENGINE_FAILURE`. Import it in a .gu\n// project with:\n//\n//     use std::EngineFailure;\n//\n// and use the variants in state field types, e.g.:\n//\n//     state Failed(failure: EngineFailure)\n//\n// Domain-specific failure enums can wrap this to preserve the engine\n// layer while adding domain variants:\n//\n//     enum SlackFailure {\n//         Engine(EngineFailure),\n//         RateLimited(i64),\n//         ChannelNotFound(String),\n//     }\n//\n// Variant payload positions (documented here because Gust enum variants\n// currently take positional types, not named fields):\n//\n//   UserError(reason)\n//       reason: String\n//\n//   SystemError(reason, attempt)\n//       reason:  String  -- human-readable description\n//       attempt: i64     -- attempt number (1-based)\n//\n//   IntegrationError(service, status_code, body)\n//       service:     String  -- downstream service identifier\n//       status_code: i64     -- HTTP-style status from the service\n//       body:        String  -- raw response body\n//\n//   Timeout(wall_clock_ms)\n//       wall_clock_ms: i64   -- elapsed milliseconds at the timeout\n//\n//   Cancelled(requested_by)\n//       requested_by: String -- opaque canceller identifier\n\nenum EngineFailure {\n    UserError(String),\n    SystemError(String, i64),\n    IntegrationError(String, i64, String),\n    Timeout(i64),\n    Cancelled(String),\n}\n";
Expand description

The Gust source for the EngineFailure enum.

A typed runtime/engine failure surface for workflow-style machines. Workflow runtimes (e.g. Corsac) use this as a stable failure type so retry policies, replay semantics, and observability can reason about failures without parsing strings. Domain-specific failure enums can wrap EngineFailure to preserve the engine layer while adding domain variants.

Variants (positional payloads — see the source for field descriptions):

  • UserError(String)
  • SystemError(String, i64)
  • IntegrationError(String, i64, String)
  • Timeout(i64)
  • Cancelled(String)

Import in a .gu file with use std::EngineFailure;.