eliza_error 0.99.1

“Times are bad. Children no longer obey their parents, and everyone is writing an error handling library.” — Cicero
Documentation
  • Coverage
  • 66.67%
    4 out of 6 items documented1 out of 3 items with examples
  • Size
  • Source code size: 6.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 740.94 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • hawkw/eliza_error
    8 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hawkw

“Times are bad. Children no longer obey their parents, and everyone is writing an error handling library.” — Cicero

fast, cheap, and out of control exceptions for rust.

Usage

First, add this to your Cargo.toml:

[dependencies]
eliza_error = "0.99.0";

You can now throw exceptions!

use eliza_error::{Error, throw};

fn my_great_function() -> Result<(), Error> {
    if is_everything_terrible() {
        throw!("everything is terrible!");
    }
    Ok(())
}

Eliza errors also work fine with errors from the standard library.

use eliza_error::{Error, throw};
use std::fs::File;
use std::io::prelude::*;

fn look_at_file() -> Result<(), Error> {
    let mut file = File::open("this_file_doesnt_exist.txt")?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;
    if contents == "everything is terrible!!!" {
        throw!("wow, everything is still terrible!!!");
    }
    Ok(())
}

Why should I use this?