Skip to content

Commit

Permalink
Add the code markdown to the Rust types
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasavola authored Aug 12, 2024
1 parent e967db6 commit ebb1374
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs/detectors/9-avoid-panic-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

The panic! macro is used to stop execution when a condition is not met. This is useful for testing and prototyping, but should be avoided in production code.

Using Result as return type for functions that can fail is the idiomatic way to handle errors in Rust. The Result type is an enum that can be either Ok or Err. The Err variant can contain an error message. The ? operator can be used to propagate the error message to the caller.
Using `Result` as return type for functions that can fail is the idiomatic way to handle errors in Rust. The `Result` type is an enum that can be either `Ok` or `Err`. The `Err` variant can contain an error message. The `?` operator can be used to propagate the error message to the caller.

This way, the caller can decide how to handle the error, although the state of the contract is always reverted on the callee.

Expand Down

0 comments on commit ebb1374

Please sign in to comment.