1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Demonstrates default constructor generation in #[derive(Error)].

use ohno::{Error, OhnoCore};

#[derive(Error)]
struct MyError {
    path: String,
    inner: OhnoCore,
}

fn main() {
    let _error = MyError::new("/etc/config");
    let error_with_cause = MyError::caused_by("/etc/config", "File not found");
    println!("Error: {error_with_cause}");
}