23 lines
357 B
Rust
23 lines
357 B
Rust
|
use ctxerr_derive::ctxerr;
|
||
|
|
||
|
#[ctxerr]
|
||
|
pub enum ErrorKind {
|
||
|
#[error("Some error {0}")]
|
||
|
Error1(#[from] std::io::Error),
|
||
|
}
|
||
|
|
||
|
fn operation() -> Result<(), std::io::Error> {
|
||
|
std::fs::File::open("")?;
|
||
|
Ok(())
|
||
|
}
|
||
|
|
||
|
fn test() -> Result<(), Error> {
|
||
|
Ok(operation()?)
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
if let Err(err) = test() {
|
||
|
println!("{}", err);
|
||
|
}
|
||
|
}
|