4 ms·
With proper error handling instead of unwrap(), which means "I don't care about errors here".
by lisivka 10y ago
With proper error handling instead of unwrap(), which means "I don't care about errors here".
- Dylan16807 10y agoWhat does proper error handling look like when I want to use the same "invalid node" error for most of those unwrap calls?
- EugeneOZ 10y agoUse "try" or "?" if possible, pattern matching otherwise.
- staticassertion 10y agoYou can use map or and_then, you can write a macro, you can use try!, you can use if let, etc. There are lots of ways to handle errors in rust.