Skip to content

Commit 358d7da

Browse files
manish7017mgeisler
andauthored
Update catch_unwind example (#1356)
Fixes #1352. --------- Co-authored-by: Martin Geisler <[email protected]>
1 parent de0e8e6 commit 358d7da

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/error-handling/panic-unwind.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use std::panic;
77
88
fn main() {
99
let result = panic::catch_unwind(|| {
10-
println!("hello!");
10+
"No problem here!"
1111
});
12-
assert!(result.is_ok());
13-
12+
println!("{result:?}");
13+
1414
let result = panic::catch_unwind(|| {
1515
panic!("oh no!");
1616
});
17-
assert!(result.is_err());
17+
println!("{result:?}");
1818
}
1919
```
2020

21-
* This can be useful in servers which should keep running even if a single
21+
- This can be useful in servers which should keep running even if a single
2222
request crashes.
23-
* This does not work if `panic = 'abort'` is set in your `Cargo.toml`.
23+
- This does not work if `panic = 'abort'` is set in your `Cargo.toml`.

0 commit comments

Comments
 (0)