mirror of https://github.com/rust-lang/rustlings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
b7ddd09fab
Adjust error text and naming to conform with best practices. Use `map_err()` instead of `or()`. Wrap lower-level errors instead of ignoring their details. Also, don't "cheat" by bypassing the `new()` function in tests. Fix a dangling reference in the try_from_into hints. |
3 years ago | |
---|---|---|
.. | ||
README.md | 3 years ago | |
errors1.rs | 5 years ago | |
errors2.rs | 5 years ago | |
errors3.rs | 5 years ago | |
errors4.rs | 3 years ago | |
errors5.rs | 3 years ago | |
errors6.rs | 3 years ago |
README.md
Error handling
Most errors aren’t serious enough to require the program to stop entirely. Sometimes, when a function fails, it’s for a reason that you can easily interpret and respond to. For example, if you try to open a file and that operation fails because the file doesn’t exist, you might want to create the file instead of terminating the process.