1use std::process::{ExitCode, Termination};
4
5use error_stack::{Context, Report};
6
7#[derive(Debug)]
8struct CustomError;
9
10impl Context for CustomError {}
11
12impl core::fmt::Display for CustomError {
13 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
14 f.write_str("Custom Error")
15 }
16}
17
18fn main() -> ExitCode {
19 let report = Report::new(CustomError)
20 .attach(ExitCode::from(100))
21 .attach_printable("this error has an exit code of 100!");
22
23 report.report()
24}