mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 15:40:27 +08:00
Update ch09-03-to-panic-or-not-to-panic.md
This commit is contained in:
parent
871ebab8df
commit
c88e602b7b
@ -73,9 +73,9 @@ we'd definitely want to handle the `Result` in a more robust way instead.
|
||||
### Guidelines for Error Handling
|
||||
|
||||
It's advisable to have your code `panic!` when it's possible that you could end
|
||||
up in a *bad state*---in this context, *bad state* is when some assumption,
|
||||
up in a *bad state*—in this context, *bad state* is when some assumption,
|
||||
guarantee, contract, or invariant has been broken, such as when invalid values,
|
||||
contradictory values, or missing values are passed to your code---plus one or
|
||||
contradictory values, or missing values are passed to your code—plus one or
|
||||
more of the following:
|
||||
|
||||
* The bad state is not something that's *expected* to happen occasionally
|
||||
|
Loading…
Reference in New Issue
Block a user