-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented more
thiserror
for libcontainer (Part 2) (#1881)
Implemented more thiserror for the libcontainer. This PR covers most of the low hanging fruits with smaller crates. Note, I decided to add a new syscall error wrapper that wraps the nix::Error, std::io::Error, and our own syscall crate. This aims to simplify where we call syscalls from 3 different sources and can simplify/unify many errors. --------- Signed-off-by: yihuaf <[email protected]>
- Loading branch information
Showing
12 changed files
with
330 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// UnifiedSyscallError aims to simplify error handling of syscalls in | ||
/// libcontainer. In many occasions, we mix nix::Error, std::io::Error and our | ||
/// own syscall wrappers, which makes error handling complicated. | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum UnifiedSyscallError { | ||
#[error(transparent)] | ||
Io(#[from] std::io::Error), | ||
#[error(transparent)] | ||
Nix(#[from] nix::Error), | ||
#[error(transparent)] | ||
Syscall(#[from] crate::syscall::SyscallError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.