Module std.failure

Crash details and recovery decisions for actor lifecycle hooks.

Import std.failure to name CrashInfo or CrashAction explicitly in a #[on(crash)] hook's signature. The hook observes the actor's last valid state after its handlers drain and chooses the supervisor's recovery action. Actor state is released after the hook returns.

CrashInfo carries kind + message

kind identifies the public crash class using CrashKind. message is a heap-owned diagnostic string the runtime supplies (empty when no message is available); a crash hook can log or route on it.

Contents

Types

Struct CrashInfo

Diagnostic payload passed to #[on(crash)] hooks.

Match kind to choose a recovery action. message carries a heap-owned diagnostic string (empty when unavailable); private runtime fault codes are not part of this record.

Fields

kind: CrashKind
message: string

Enum CrashAction

Recovery action returned by a #[on(crash)] hook.

  • Restart: apply the child's ordinary restart policy, budget and circuit breaker. A temporary child is not restarted.
  • Escalate: transfer the failure to the parent supervisor instead of restarting locally. At the root the failure remains unrecovered.
  • GiveUp: permanently spend the child's role and leave the failure unrecovered.

Variants

Restart
Escalate
GiveUp

Enum DownTarget

Identity reported by a monitor or link notification.

Local names an actor incarnation's process-local slot, Remote names a complete remote incarnation, and Role names a stable local supervised role when it has no current actor. Observing an occupied role selects its current incarnation; a vacant-role notification does not subscribe to a later replacement.

Variants

Local(u64)

A process-local actor slot.

Remote(Location)

A complete remote actor location.

Role(u64)

A stable local supervised role with no current actor incarnation.

Struct CrashNotification

Identity and class of a crash propagated to a linked actor.

Delivered to the linked actor's #[on(link)] hook. Remote identities retain the node, actor slot and session incarnation from the authenticated notice. Signal numbers, fault addresses and other private crash details stay with the crashed actor and its supervisor.

Fields

target: DownTarget
kind: CrashKind

Enum CrashKind

Class of an actor crash, observed by crash and link hooks.

These variants are the crash classes exposed at the link boundary; more detailed runtime reasons remain private to the crashed actor and supervisor.

Variants

Fault

Generic crash from panic(...), hew_panic(), or an unclassified trap (SEGV / BUS / FPE / ILL / TRAP).

HeapExceeded

Per-actor arena cap exceeded.

PartitionDetected

A remote link became unreachable under its partition policy.

HandlerFailed

A mailbox handler returned a declared error without a waiting caller.

TimerOverdue

An actor-owned timer was discarded or missed its handler-start deadline.