pub struct ParamErrorContext {
pub param_type: ParamType,
pub field_name: Option<String>,
pub message: String,
pub source_message: Option<String>,
pub raw_value: Option<String>,
pub expected_type: Option<String>,
}Expand description
Detailed context for parameter extraction errors
Fields§
§param_type: ParamTypeParameter type (Json, Query, Path, Form, Header, etc.)
field_name: Option<String>Field name if identifiable
message: StringError message
source_message: Option<String>Original source error (not cloneable, so we store the message)
raw_value: Option<String>Original value (for debugging, sensitive data should be excluded)
expected_type: Option<String>Expected type name
Implementations§
Source§impl ParamErrorContext
impl ParamErrorContext
Sourcepub fn new(param_type: ParamType, message: impl Into<String>) -> Self
pub fn new(param_type: ParamType, message: impl Into<String>) -> Self
Create a new ParamErrorContext
Sourcepub fn with_field(self, field: impl Into<String>) -> Self
pub fn with_field(self, field: impl Into<String>) -> Self
Set the field name
Sourcepub fn with_raw_value(self, value: impl Into<String>) -> Self
pub fn with_raw_value(self, value: impl Into<String>) -> Self
Set the raw value (truncated if too long)
Sourcepub fn with_expected_type<T>(self) -> Self
pub fn with_expected_type<T>(self) -> Self
Set the expected type
Sourcepub fn format_error(&self) -> String
pub fn format_error(&self) -> String
Format error as single line (for Display trait)
Sourcepub fn format_multiline(&self, include_raw_value: bool) -> String
pub fn format_multiline(&self, include_raw_value: bool) -> String
Format error as multiple lines (for detailed logging)
Trait Implementations§
Source§impl Clone for ParamErrorContext
impl Clone for ParamErrorContext
Source§fn clone(&self) -> ParamErrorContext
fn clone(&self) -> ParamErrorContext
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 ParamErrorContext
impl RefUnwindSafe for ParamErrorContext
impl Send for ParamErrorContext
impl Sync for ParamErrorContext
impl Unpin for ParamErrorContext
impl UnsafeUnpin for ParamErrorContext
impl UnwindSafe for ParamErrorContext
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 more