Skip to main content

FsError

Struct FsError 

Source
pub struct FsError {
    pub kind: FsErrorKind,
    pub operation: FsOperation,
    pub path: Option<Box<FsPath>>,
    pub target: Option<Box<FsPath>>,
    pub provider: Option<Box<str>>,
    pub message: Box<str>,
    pub source: Option<Box<dyn Error + Send + Sync + 'static>>,
}
Expand description

Provider-neutral filesystem error with operation and path context.

Fields§

§kind: FsErrorKind

Error category.

§operation: FsOperation

Operation that produced the error.

§path: Option<Box<FsPath>>

Primary path involved in the operation.

§target: Option<Box<FsPath>>

Secondary path involved in the operation.

§provider: Option<Box<str>>

Provider id or alias involved in the operation.

§message: Box<str>

Human-readable error message.

§source: Option<Box<dyn Error + Send + Sync + 'static>>

Lower-level source error.

Implementations§

Source§

impl FsError

Source

pub fn new(kind: FsErrorKind, operation: FsOperation, message: &str) -> Self

Creates a filesystem error without path or provider context.

§Parameters
  • kind: Provider-neutral error category.
  • operation: Operation that produced the error.
  • message: Human-readable diagnostic message.
§Returns

New filesystem error.

Source

pub fn with_source<E>( kind: FsErrorKind, operation: FsOperation, message: &str, source: E, ) -> Self
where E: Error + Send + Sync + 'static,

Creates a filesystem error that wraps a lower-level source error.

§Parameters
  • kind: Provider-neutral error category.
  • operation: Operation that produced the error.
  • message: Human-readable diagnostic message.
  • source: Lower-level error to preserve.
§Returns

New filesystem error with source context.

Source

pub fn with_path(self, path: FsPath) -> Self

Adds primary path context.

§Parameters
  • path: Primary path involved in the operation.
§Returns

Updated filesystem error.

Source

pub fn with_target(self, target: FsPath) -> Self

Adds secondary target path context.

§Parameters
  • target: Secondary path involved in the operation.
§Returns

Updated filesystem error.

Source

pub fn with_provider(self, provider: &str) -> Self

Adds provider context.

§Parameters
  • provider: Provider id or alias involved in the operation.
§Returns

Updated filesystem error.

Source

pub fn invalid_path(operation: FsOperation, message: &str) -> Self

Creates an invalid-path error.

§Parameters
  • operation: Operation that rejected the path.
  • message: Human-readable reason.
§Returns

Invalid-path filesystem error.

Source

pub fn kind(&self) -> FsErrorKind

Gets the error kind.

§Returns

Error category.

Trait Implementations§

Source§

impl Debug for FsError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FsError

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl Error for FsError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.