Skip to content

Commit

Permalink
panic with message
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi committed May 15, 2024
1 parent c2116ce commit b867427
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions uplink/src/base/bridge/actions_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,17 @@ impl ActionsBridge {
/// else marks the current action as cancelled and avoids further redirections
async fn handle_cancellation(&mut self, action: Action) -> Result<(), Error> {
let cancellation: Cancellation = serde_json::from_str(&action.payload)?;
if cancellation.action_id != self.current_action.as_ref().unwrap().id {
let current_action = self
.current_action
.as_ref()
.expect("Actions that are not executing can't be cancelled");
if cancellation.action_id != current_action.id {
warn!("Unexpected cancellation: {cancellation:?}");
self.forward_action_error(action, Error::UnexpectedCancellation).await;
return Ok(());
}

if cancellation.name != self.current_action.as_ref().unwrap().action.name {
if cancellation.name != current_action.action.name {
warn!("Unexpected cancellation: {cancellation:?}");
self.forward_action_error(action, Error::CorruptedCancellation).await;
return Ok(());
Expand Down

0 comments on commit b867427

Please sign in to comment.