Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Add missing `` ticks to ensure! macro #325

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/src/bail-and-ensure.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `bail!` and `ensure!`

If you were a fan of the `bail!` and ensure! macros from error-chain, good news. failure has a version of these macros as well.
If you were a fan of the `bail!` and `ensure!` macros from error-chain, good news. failure has a version of these macros as well.

The `bail!` macro returns an error immediately, based on a format string. The `ensure!` macro additionally takes a conditional, and returns the error only if that conditional is false. You can think of `bail!` and `ensure!` as being analogous to `panic!` and `assert!`, but throwing errors instead of panicking.

Expand All @@ -15,4 +15,4 @@ fn safe_cast_to_unsigned(n:i32) -> Result<u32, error::Failure>
ensure!(n>=0, "number cannot be smaller than 0!");
(u32) n
}
```
```