Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Don't panic in Offchain test context, when we are already panicking (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr committed Nov 1, 2019
1 parent a2191ee commit cf90ba6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/offchain/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ impl State {

impl Drop for State {
fn drop(&mut self) {
if !self.expected_requests.is_empty() {
// If we panic! while we are already in a panic, the test dies with an illegal instruction.
if !self.expected_requests.is_empty() && !std::thread::panicking() {
panic!("Unfulfilled expected requests: {:?}", self.expected_requests);
}
}
Expand Down

0 comments on commit cf90ba6

Please sign in to comment.