| Crates.io | eoe |
| lib.rs | eoe |
| version | 0.3.3 |
| created_at | 2024-07-09 01:46:28.573365+00 |
| updated_at | 2025-09-01 19:43:54.918527+00 |
| description | This crate provides utilities for exiting processes on errors gracefully. |
| homepage | |
| repository | https://github.com/Lingxuan-Ye/eoe |
| max_upload_size | |
| id | 1296573 |
| size | 18,624 |
This crate provides utilities for exiting processes on errors gracefully, leveraging anyhow to display detailed error context and chained messages.
Exiting on error:
use anyhow::{Context, anyhow};
use eoe::ExitOnError;
Err::<(), _>(anyhow!("Mm-noom-ba-deh"))
.context("Doom-boom-ba-beh")
.context("Doo-boo-boom-ba-beh-beh")
.exit_on_error();
Or if you prefer the word quit:
use anyhow::{Context, anyhow};
use eoe::QuitOnError;
Err::<(), _>(anyhow!("Mm-ba-ba-beh, mm-ba-ba-beh"))
.context("Dee-day-da, ee-day-da")
.quit_on_error();
The output style is customizable:
use eoe::{ExitOnError, Segment, Style};
let _ = eoe::ERROR.set(Segment {
style: Style::new().bold().blue(),
value: "Watchin' some good friends screamin'",
});
let _ = eoe::SEP.set(Segment {
style: Style::new(),
value: " 😱 ",
});
let _ = eoe::MESSAGE_STYLE.set(Style::new().italic().yellow());
let _ = eoe::MESSAGE_ON_NONE.set("Let me out");
None::<()>.exit_on_error();