Skip to main content

Module ctx

Module ctx 

Source
Expand description

Error context wrapper for sys_traits operations.

This module provides SysWithPathsInErrors, a wrapper that adds operation and path context to errors returned by sys_traits methods.

§Example

use sys_traits::PathsInErrorsExt;
use sys_traits::impls::RealSys;

let sys = RealSys;

// Without context:
// sys.fs_read("/path/to/file")?;
// Error: No such file or directory (os error 2)

// With context:
sys.with_paths_in_errors().fs_read("/path/to/file")?;
// Error: failed to read '/path/to/file': No such file or directory (os error 2)

Structs§

FsFileWithPathsInErrors
A file wrapper that includes the path in error messages.
OperationError
An error that includes context about the operation that failed.
SysWithPathsInErrors
A wrapper that adds error context to sys_traits operations.

Enums§

OperationErrorKind
The kind of context associated with an operation error.

Traits§

PathsInErrorsExt
Extension trait that provides the with_paths_in_errors method.