arui_core/errors.rs
1//! 自定义错误模块
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum IOError {
7 #[error("Invalid path: {0}")]
8 InvalidPath(String),
9 #[error(transparent)]
10 IO(#[from] std::io::Error),
11}
12
13// #[cfg(test)]
14// mod tests {
15// use crate::errors::IOError;
16// use std::error::Error;
17//
18// #[test]
19// fn test_io_error() {
20// let error = IOError::GetFileInfo(std::io::Error::from(std::io::ErrorKind::NotFound));
21// assert_eq!(error.to_string(), "Failed to get file info: Not found (os error 2)");
22// }
23// }