Skip to main content

5 docs tagged with "error-handling"

View all tags

`panic!` and Unrecoverable Errors

In the previous article, we learned how to handle recoverable errors with the Result enum. However, sometimes errors are not recoverable. For these situations, Rust has the panic! macro.

Project: Guessing Game (Part 3)

Welcome to the final part of our Guessing Game project! In Part 2, we added the core logic for comparing the user's guess to the secret number. In this article, we'll add the final polish to our game by handling invalid input gracefully and improving the looping mechanism.

The `Result` Enum and Error Handling

In the previous article, we learned how the Option enum is used to handle values that might be absent. Now, we'll look at another crucial enum from the standard library: Result. The Result enum is the primary way that Rust handles operations that can fail, such as reading a file or parsing a string.