-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove install_panic_handler from non-wasm32 builds
- Loading branch information
1 parent
d37cc82
commit 95f2528
Showing
1 changed file
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
/// When compiled to Wasm, this installs a panic handler that aborts the | ||
/// contract execution and sends the panic message and location to the host. | ||
/// For other targets, this is a noop. | ||
/// Installs a panic handler that aborts the contract execution | ||
/// and sends the panic message and location to the host. | ||
/// | ||
/// This overrides any previous panic handler. See <https://doc.rust-lang.org/std/panic/fn.set_hook.html> | ||
/// for details. | ||
#[cfg(feature = "abort")] | ||
#[cfg(all(feature = "abort", target_arch = "wasm32"))] | ||
pub fn install_panic_handler() { | ||
#[cfg(target_arch = "wasm32")] | ||
{ | ||
use super::imports::handle_panic; | ||
std::panic::set_hook(Box::new(|info| { | ||
// E.g. "panicked at 'oh no (a = 3)', src/contract.rs:51:5" | ||
let full_message = info.to_string(); | ||
handle_panic(&full_message); | ||
})); | ||
} | ||
use super::imports::handle_panic; | ||
std::panic::set_hook(Box::new(|info| { | ||
// E.g. "panicked at 'oh no (a = 3)', src/contract.rs:51:5" | ||
let full_message = info.to_string(); | ||
handle_panic(&full_message); | ||
})); | ||
} |