mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Fixed panic handling (#1667)
This commit is contained in:
committed by
Bastian Köcher
parent
87f0f6fd8f
commit
6c341f4e9d
@@ -13,6 +13,7 @@ trie = { package = "substrate-trie", path = "../trie" }
|
||||
serializer = { package = "substrate-serializer", path = "../serializer" }
|
||||
state_machine = { package = "substrate-state-machine", path = "../state-machine" }
|
||||
runtime_version = { package = "sr-version", path = "../sr-version" }
|
||||
panic-handler = { package = "substrate-panic-handler", path = "../panic-handler" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
wasmi = { version = "0.4.3" }
|
||||
|
||||
@@ -97,11 +97,9 @@ fn fetch_cached_runtime_version<'a, E: Externalities<Blake2Hasher>>(
|
||||
fn safe_call<F, U>(f: F) -> Result<U>
|
||||
where F: UnwindSafe + FnOnce() -> U
|
||||
{
|
||||
// Substrate uses custom panic hook that terminates process on panic. Disable it for the native call.
|
||||
let hook = ::std::panic::take_hook();
|
||||
let result = ::std::panic::catch_unwind(f).map_err(|_| ErrorKind::Runtime.into());
|
||||
::std::panic::set_hook(hook);
|
||||
result
|
||||
// Substrate uses custom panic hook that terminates process on panic. Disable termination for the native call.
|
||||
let _guard = panic_handler::AbortGuard::new(false);
|
||||
::std::panic::catch_unwind(f).map_err(|_| ErrorKind::Runtime.into())
|
||||
}
|
||||
|
||||
/// Set up the externalities and safe calling environment to execute calls to a native runtime.
|
||||
|
||||
Reference in New Issue
Block a user