Skip to content

Commit

Permalink
Panick the whole program when actor panick
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Jan 2, 2025
1 parent 125c464 commit ebd55d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/actors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ractor::{async_trait as rasync_trait, Actor, ActorProcessingErr, ActorRef, SupervisionEvent};
use tokio_util::{sync::CancellationToken, task::TaskTracker};
use tracing::{debug, error};
use tracing::debug;

/// A root actor that listens for cancellation token and stops all sub actors (those who started by spawn_linked).
pub struct RootActor;
Expand Down Expand Up @@ -69,7 +69,7 @@ impl Actor for RootActor {
}
},
SupervisionEvent::ActorPanicked(who, err) => {
error!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err);
panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err);
}
_ => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/fiber/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2278,8 +2278,8 @@ where
SupervisionEvent::ActorTerminated(who, _, _) => {
debug!("{:?} terminated", who);
}
SupervisionEvent::ActorPanicked(who, _) => {
error!("{:?} panicked", who);
SupervisionEvent::ActorPanicked(who, err) => {
panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err);
}
_ => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/fiber/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3143,8 +3143,8 @@ where
SupervisionEvent::ActorTerminated(who, _, _) => {
debug!("Actor {:?} terminated", who);
}
SupervisionEvent::ActorPanicked(who, _) => {
error!("Actor {:?} panicked", who);
SupervisionEvent::ActorPanicked(who, err) => {
panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err);
}
_ => {}
}
Expand Down

0 comments on commit ebd55d7

Please sign in to comment.