1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Error types for the actor system.
//!
use thiserror::Error;
/// Result type for actor operations.
pub type Result<T> = std::result::Result<T, ActorError>;
// use crate::Actor;
/// Errors produced from within the actor event-loop.
#[derive(Error, Debug, PartialEq)]
#[non_exhaustive]
pub enum ActorError {
/// The sender failed to send a message on an internal channel.
#[error("Failed to send message")]
AsyncSendError(#[from] futures::channel::mpsc::SendError),
/// The channel that is used to determine that the actor has stopped was closed unexpectedly.
/// This usually means that the actor task was canceled or panicked.
#[error("Call got canceled")]
Canceled(#[from] futures::channel::oneshot::Canceled),
/// The actor's channel is closed, so the message could not be delivered.
/// This happens when the actor has stopped or is in the process of stopping.
#[error("Channel closed: message could not be delivered")]
ChannelClosed,
/// The control signal (stop/restart) could not be sent because the actor already stopped.
#[error("Actor already stopped")]
AlreadyStopped,
/// The weak reference could not be upgraded because the actor was dropped.
/// All strong references to this actor are gone.
#[error("Actor dropped: weak reference expired")]
ActorDropped,
/// Failed to join actor task
#[error("Failed to join actor task")]
FailedToJoin,
/// Indicates that a services failed to be registered because an instance of the same type is already registered.
#[error("Service already registered")]
ServiceStillRunning,
/// Indicates that an actor's task took too long to complete.
#[error("Actor's task took too long to complete")]
Timeout,
}