Skip to main content

http_type/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,
10    CustomDebug,
11    Default,
12    Deserialize,
13    DisplayDebug,
14    Eq,
15    Getter,
16    PartialEq,
17    Serialize,
18    Setter,
19    New,
20)]
21pub struct PanicData {
22    /// The message associated with the panic.
23    /// This is `None` if the panic payload is not a string.
24    #[get(pub)]
25    #[set(pub(crate))]
26    pub(super) message: Option<String>,
27    /// The source code location where the panic occurred.
28    #[get(pub)]
29    #[set(pub(crate))]
30    pub(super) location: Option<String>,
31    /// The payload of the panic, often a string literal.
32    /// The hook attempts to downcast it to a `&str` or `String`.
33    #[get(pub)]
34    #[set(pub(crate))]
35    pub(super) payload: Option<String>,
36}