fn main() {
let err = build_error();
println!("== Default output with backtraces ==\n");
println!("{}\n", err.message_with_backtrace());
println!("== Pretty output with backtraces ==\n");
println!("{}", human_errors::pretty_with_backtraces(&err));
}
fn build_error() -> human_errors::Error {
human_errors::wrap_user(
human_errors::wrap_system(
std::io::Error::new(
std::io::ErrorKind::PermissionDenied,
"os error 13: permission denied",
),
"We were unable to read the configuration file at /etc/demo/config.yml due to an I/O failure.",
&["Ensure the application has permission to read the file and that the file exists."],
),
"We could not load your configuration.",
&["Check that the --config option points to a readable file."],
)
}