eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
362 stars 106 forks source link

Change some IO error handling code #224

Closed eminence closed 1 year ago

eminence commented 1 year ago

This commit makes a few minor changes to how IO error handling works.

Throughout procfs, we try to always keep track of what Path is associated with an IO error. This is done via the IoErrorWrapper struct and the wrap_io_error! macro.

The IoErrorWrapper inner error is no longer optional, which should save a boxing.

When constructing an ProcError from a std::io::Error, the inner IoErrorWrapper is removed if present, and the actual underlying IO Error is used instead. This makes it possible to inspect the details of that underlying error.

Also, the ESRCH error is now mapped to the ProcError::NotFound error, for convenience.

Closes #208