pub struct DebugError {
pub error_type: String,
pub message: String,
pub file: String,
pub line: usize,
pub stack: Vec<StackFrame>,
pub method: String,
pub uri: String,
pub headers: HashMap<String, String>,
pub query_params: HashMap<String, String>,
}Expand description
调试错误信息
包含完整的错误上下文:消息、类型、堆栈、请求信息。
由 render_debug_html 渲染为 Whoops-style HTML。
Fields§
§error_type: String错误类型名(如 "panic" / "IoError" / "SqlError")
message: String错误消息
file: String错误发生的文件
line: usize错误发生的行号(1-based)
stack: Vec<StackFrame>堆栈帧列表(按调用顺序:最新帧在前)
method: String请求方法
uri: String请求 URI
headers: HashMap<String, String>请求头(已脱敏)
query_params: HashMap<String, String>请求查询参数
Implementations§
Source§impl DebugError
impl DebugError
Sourcepub fn new(
error_type: impl Into<String>,
message: impl Into<String>,
file: impl Into<String>,
line: usize,
) -> DebugError
pub fn new( error_type: impl Into<String>, message: impl Into<String>, file: impl Into<String>, line: usize, ) -> DebugError
创建新的调试错误
Sourcepub fn with_frame(self, frame: StackFrame) -> DebugError
pub fn with_frame(self, frame: StackFrame) -> DebugError
添加堆栈帧
Sourcepub fn with_request(
self,
method: impl Into<String>,
uri: impl Into<String>,
headers: HeaderMap,
query_params: HashMap<String, String>,
) -> DebugError
pub fn with_request( self, method: impl Into<String>, uri: impl Into<String>, headers: HeaderMap, query_params: HashMap<String, String>, ) -> DebugError
设置请求信息
Sourcepub fn with_source_snippet(self, context: usize) -> DebugError
pub fn with_source_snippet(self, context: usize) -> DebugError
Trait Implementations§
Source§impl Clone for DebugError
impl Clone for DebugError
Source§fn clone(&self) -> DebugError
fn clone(&self) -> DebugError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DebugError
impl RefUnwindSafe for DebugError
impl Send for DebugError
impl Sync for DebugError
impl Unpin for DebugError
impl UnsafeUnpin for DebugError
impl UnwindSafe for DebugError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.