Skip to content

Commit

Permalink
Merge pull request #435 from contrun/panic-the-whole-program-when-act…
Browse files Browse the repository at this point in the history
…or-panic

Panick the whole program when actor panick
  • Loading branch information
quake authored Jan 2, 2025
2 parents 125c464 + ebd55d7 commit 363e031
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 363e031

Please sign in to comment.