Errors everywhere

krizma
1 min readMar 21, 2021

If you program in Python you can write easily programs that have a very bad error handling, and you will probably notice it during runtime, when the errors actually happen. It can be a nightmare.

In Rust you’re forced by the compiler to handle the errors, just like exceptions in Java, but in a very different way.

The main problem with more complicated error handling and static types is that you can use a lot of different libraries with their special error types, and it’s a bit tedious to have a match case for all of them. Fortunately Rust has solutions for these kind of problems, too.

I have collected some useful links that describe the error handling more clearly than the official Rust book (some of them is based on earlier versions of the language, but they explain the concept quite cleary, so worth reading them):

And the most recent one:

https://stevedonovan.github.io/rust-gentle-intro/6-error-handling.html

--

--