Skip to content

Commit

Permalink
fix(chisel): on edit fail command only if execution failed (#9155)
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy authored Oct 24, 2024
1 parent b1e9365 commit 9fe891a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions crates/chisel/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,18 +719,20 @@ impl ChiselDispatcher {
}
}

// If the contract execution failed, continue on without
// updating the source.
DispatchResult::CommandFailed(Self::make_error(
"Failed to execute edited contract!",
))
} else {
// the code could be compiled, save it
*self.source_mut() = new_session_source;
DispatchResult::CommandSuccess(Some(String::from(
"Successfully edited `run()` function's body!",
)))
if failed {
// If the contract execution failed, continue on without
// updating the source.
return DispatchResult::CommandFailed(Self::make_error(
"Failed to execute edited contract!",
));
}
}

// the code could be compiled, save it
*self.source_mut() = new_session_source;
DispatchResult::CommandSuccess(Some(String::from(
"Successfully edited `run()` function's body!",
)))
}
Err(_) => {
DispatchResult::CommandFailed("The code could not be compiled".to_string())
Expand Down

0 comments on commit 9fe891a

Please sign in to comment.