Skip to content
Even more error handling experiments in Rust.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benches
examples
src
.gitignore
Cargo.toml
LICENSE
Makefile
README.md
upload-docs.sh

README.md

rust-incidents

This library provides an experiment for error handling in Rust.

It provides efficient error handling and provides powerful debugging features.

  • keeps results small by providing a de-refable failure type
  • provides support for python-style tracebacks in debug builds
  • allows errors to be freely convertible between each other through the FromError trait.
  • provides a flexible trait for error interoperability.
struct BadOperation {
    desc: &str,
}

impl Error for BadOperation {
    fn name(&self) -> &str { "Bad Operation" }
    fn description(&self) -> Option<&str> { Some(self.desc) }
}

fn something_that_fails(good: bool) -> FResult<int, BadOperation> {
    if !good {
        fail!(BadOperation { desc: "Something wend badly wrong" });
    }
    Ok(42)
}

fn function_that_tries() -> FResult<int, BadOperation> {
    let rv = try!(function_that_fails());
    Ok(rv + 42)
}
You can’t perform that action at this time.