palladium_actor/errors.rs
1use crate::path::AddrHash;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum PathParseError {
5 Empty,
6 MustStartWithSlash,
7 TrailingSlash,
8 EmptySegment,
9 InvalidSegment,
10}
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum ActorError {
14 /// `on_start` returned `Err`; actor never entered the running state.
15 Init,
16 /// `on_message` returned `Err`; supervisor's restart policy applies.
17 Handler,
18 /// Actor task panicked; `String` contains the panic display message.
19 /// Caught via `catch_unwind` in the Phase 2 event loop.
20 Panic(String),
21 /// WASM actor exhausted its fuel budget.
22 ///
23 /// Treated as `Handler`-severity: the supervisor applies the configured
24 /// restart policy (same behaviour as `Handler`).
25 ResourceExhausted,
26 /// WASM module trapped (panic, abort, illegal instruction, etc.).
27 ///
28 /// `String` contains the trap message from the WASM runtime.
29 /// Treated as `Handler`-severity: the supervisor applies the configured
30 /// restart policy.
31 WasmTrap(String),
32}
33
34#[derive(Debug, Clone, Copy, PartialEq, Eq)]
35pub enum SendError {
36 MailboxFull,
37 ConnectionFailed,
38 ActorStopped,
39 Unroutable,
40 PolicyViolation,
41 SerializationFailed,
42 Unbound,
43}
44
45#[derive(Debug, Clone, Copy, PartialEq, Eq)]
46pub enum AskError {
47 Timeout,
48 NoResponse,
49 Send(SendError),
50 TypeMismatch,
51 Unbound,
52 ActorNotFound(AddrHash),
53}
54
55#[derive(Debug, Clone, Copy, PartialEq, Eq)]
56pub enum PayloadError {
57 /// Downcast to the requested type failed.
58 TypeMismatch,
59 /// The payload is `Serialized`; typed extraction is not available.
60 WrongVariant,
61}