Skip to main content

Crate nydus_error

Crate nydus_error 

Source
Expand description

Project-wide error and result types for nydus.

This crate is the control-plane error contract, mirroring the role of nydus-error in nydus v2 and rustc_errors/linkerd-error-style dedicated error crates. The data-plane crates (nydus-backend, nydus-storage) never depend on it.

Nydus splits errors along two planes:

  • The data plane (storage, fs, and the FUSE/fanotify/NBD/UFFD read paths) keeps std::io::Result: those errors must carry an OS errno so the service edges can answer the kernel with a meaningful POSIX code.
  • Everything else (image building, config parsing, CLI, service setup) returns Result with the project-wide Error defined here.

Error wraps io::Error transparently, so data-plane failures cross into the control plane with a plain ?. Use Context to attach human-readable context while keeping the source chain intact.

Following the std guidance that an error exposes its cause either through source() or through Display but not both, Display prints only the outermost layer. Print edges (logs, eprintln!) must format errors with Error::report to keep the whole cause chain on one line.

Enums§

Error
The error type for nydus operations.

Traits§

Context
Extension trait that wraps an error with context, keeping the original error as the source of the returned Error::Context.

Type Aliases§

Result
The result type used across nydus, with the project-wide Error.