neuer-error 0.3.0

Ergonomic error handling for machines and humans.
Documentation
//! Typical error handling for developer CLI tools.
#![allow(
	dead_code,
	clippy::missing_docs_in_private_items,
	clippy::missing_const_for_fn,
	reason = "Example"
)]

use ::neuer_error::{NeuErr, Result, traits::*};
use ::std::process::ExitCode;

fn ensure_project_validity() -> Result<()> {
	Ok(())
}

fn call_preprocessor() -> Result<()> {
	Err(NeuErr::new("Binary gcc not found").into())
}

fn compile_my_code() -> Result<()> {
	ensure_project_validity().context("Project must be valid for compiling")?;
	call_preprocessor().context("Preprocessor failed")?;
	Ok(())
}

fn lint() -> Result<()> {
	Err(NeuErr::new("Warning: something is deprecated").attach_override(ExitCode::SUCCESS).into())
}

// Returning the error will automatically use the attached ExitCode or assume failure.
fn main() -> Result<()> {
	ensure_project_validity().context("Project is invalid")?;
	compile_my_code().context("Failed compiling code")?;
	lint()?;
	Ok(())
}