rust-lang-deprecated / failure

Error management

Home Page:https://rust-lang-nursery.github.io/failure/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE REQUEST] Add ability to `bail!` and `ensure!` error types.

olvyko opened this issue · comments

Today u can only bail! and ensure! error message (&str).
I suggest adding the ability to return structs and enums that implement Fail trait.

Today:

bail!("error message");
ensure!(false, "error message");

Could be:

bail!(ErrorKind::SomeError);
ensure!(false, ErrorKind::SomeError);