oasis_core_runtime/common/panic.rs
1//! Panic-related functions.
2
3/// A guard that will abort the process if dropped while panicking.
4///
5/// This is to ensure that the runtime will terminate in case there is
6/// a panic encountered during dispatch and the runtime is built with
7/// a non-abort panic handler.
8pub struct AbortOnPanic;
9
10impl Drop for AbortOnPanic {
11 fn drop(&mut self) {
12 if std::thread::panicking() {
13 crate::common::process::abort();
14 }
15 }
16}