panics
Panics. Core panic mechanism. This module provides the core panic functionality used for error handling in Cairo. It defines the basic types and functions used to trigger and manage panics, which are Cairo's mechanism for handling unrecoverable errors. Panics can be triggered in several ways: Using the panic
function:
use core::panics::panic;
panic(array!['An error occurred']);
Or using the panic!
macro:
panic!("Panic message");
This macro internally converts the message into a ByteArray
and uses panic_with_byte_array
.
Fully qualified path: core::panics