123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- use std::fmt::{Debug, Display, Formatter};
- use nix::errno::Errno;
- pub struct NixError {
- errno: Errno
- }
- impl Debug for NixError {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- Debug::fmt(&self.errno, f)
- }
- }
- impl Display for NixError {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- Display::fmt(&self.errno, f)
- }
- }
- impl std::error::Error for NixError {
- }
- impl From<Errno> for NixError {
- fn from(value: Errno) -> Self {
- Self{
- errno: value,
- }
- }
- }
- pub struct ExecError {
- err_msg: String
- }
- impl ExecError {
- pub fn from_str(s: &str) -> Self {
- Self{
- err_msg: s.to_string()
- }
- }
- }
- impl Debug for ExecError {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- write!(f, "{}", self.err_msg)
- }
- }
- impl Display for ExecError {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- write!(f, "{}", self.err_msg)
- }
- }
- impl std::error::Error for ExecError {
- }
- impl From<std::io::Error> for ExecError {
- fn from(value: std::io::Error) -> Self {
- Self{
- err_msg: format!("IO Error: {:?}", value)
- }
- }
- }
|