pub struct ErrorFormatter {
pub show_codes: bool,
pub show_context: bool,
/* private fields */
}Expand description
Error formatter.
Fields§
§show_codes: boolWhether to show error codes.
show_context: boolWhether to show request context.
Implementations§
Source§impl ErrorFormatter
impl ErrorFormatter
Sourcepub fn new(mode: OutputMode) -> Self
pub fn new(mode: OutputMode) -> Self
Create a new error formatter.
Sourcepub fn theme(self, theme: FastApiTheme) -> Self
pub fn theme(self, theme: FastApiTheme) -> Self
Set the theme.
Sourcepub fn format_validation_errors(
&self,
errors: &[ValidationErrorDetail],
) -> FormattedError
pub fn format_validation_errors( &self, errors: &[ValidationErrorDetail], ) -> FormattedError
Format a list of validation errors.
Sourcepub fn format_http_error(&self, error: &HttpErrorInfo) -> FormattedError
pub fn format_http_error(&self, error: &HttpErrorInfo) -> FormattedError
Format an HTTP error.
Sourcepub fn format_simple(&self, message: &str) -> FormattedError
pub fn format_simple(&self, message: &str) -> FormattedError
Format a simple error message.
Trait Implementations§
Source§impl Clone for ErrorFormatter
impl Clone for ErrorFormatter
Source§fn clone(&self) -> ErrorFormatter
fn clone(&self) -> ErrorFormatter
Returns a duplicate of the value. Read more
1.0.0 · 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 ErrorFormatter
impl RefUnwindSafe for ErrorFormatter
impl Send for ErrorFormatter
impl Sync for ErrorFormatter
impl Unpin for ErrorFormatter
impl UnsafeUnpin for ErrorFormatter
impl UnwindSafe for ErrorFormatter
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