Skip to main content

hyperlane/panic/
struct.rs

1use crate::*;
2
3/// Represents detailed information about a panic that has occurred within the server.
4///
5/// This struct captures essential details about a panic, such as the message,
6/// source code location, and payload. It is used by the server's panic handling
7/// mechanism and passed to the configured panic hook for custom processing.
8#[derive(
9    Clone, CustomDebug, Default, Deserialize, DisplayDebug, Eq, Getter, PartialEq, Serialize, Setter,
10)]
11pub struct PanicData {
12    /// The message associated with the panic.
13    /// This is `None` if the panic payload is not a string.
14    #[get(pub)]
15    #[set(pub(crate))]
16    pub(super) message: Option<String>,
17    /// The source code location where the panic occurred.
18    #[get(pub)]
19    #[set(pub(crate))]
20    pub(super) location: Option<String>,
21    /// The payload of the panic, often a string literal.
22    /// The hook attempts to downcast it to a `&str` or `String`.
23    #[get(pub)]
24    #[set(pub(crate))]
25    pub(super) payload: Option<String>,
26}