[−][src]Macro witcher::bail
Bail early from a function with an Error
.
bail!
just provides an implementation of the common error handling practice of allowing
a user to return immediately with an error. Using bail!("oh no!")
is the same thing as
if you were to use return Error::new("oh no!")
or return Err(Error::raw("oh no!")
.
It also provides a variation to allow for format!() type formatting.
Examples
ⓘThis example is not tested
bail!("oh no!"); bail!("foo: {}", "oh no!");