hyperion::assert::panic#
- group panic
This module provides an API for triggering and handling runtime “panics”. “Panics” are a runtime error triggered when an irrecoverable error has occurred or been detected, such as a programming bug or fatal environmental problem.
By default, panics will print their associated panic message, along with syntax highlighted source location info and a backtrace, to
stderr, then trigger a breakpoint in debug builds, or a forced termination in release builds. this behavior can be customized be registering a custom handler withhyperion::assert::panic::set_handler.Example#
HYPERION_PANIC("A fatal error has occurred: {}", some_context_variable);
Defines
-
HYPERION_PANIC(...)#
Triggers a runtime “panic” “Panics” are a runtime error triggered when an irrecoverable error has occurred or been detected, such as a programming bug or fatal environmental problem.
By default, panics will print their associated panic message, along with syntax highlighted source location info and a backtrace, to
stderr, then trigger a breakpoint in debug builds, or a forced termination in release builds. this behavior can be customized be registering a custom handler withhyperion::assert::panic::set_handler.Example#
HYPERION_PANIC("A fatal error has occurred: {}", some_context_variable);
Typedefs
-
using Handler = void (*)(const std::string_view panic_message, const hyperion::source_location &location, const Backtrace &backtrace) noexcept#
Handleris the function pointer type for a valid hyperion panic handler. aHandlermust returnvoidand take the following arguments, in their presented order:std::string_viewpanic_message: The pre-formatted panic message used in the invocation,hyperion::source_locationlocation: The source location information,hyperion::assert::Backtracebacktrace: The backtrace of the code up to and including the invocation of the panic
Functions
-
auto set_handler(Handler handler) noexcept -> void#
Registers the given panic handler,
handleras the active panic handler in the program.- Parameters:
handler – The panic handler to register
-
HYPERION_PANIC(...)#