Rust gives us a lot of freedom in how we want to pursue error handling. I prefer creating custom errors and making use of the traits From, Debug, Display and Error.
Find this code on my Github: https://github.com/Thodin/custom-errors/
Timestamps:
00:00 What do we want from error handling
03:53 Csv reading without error handling
11:47 Custom errors
12:14 Result type alias
14:06 Wrapping debug data
15:36 collecting Result Vec
18:08 Bubbling up errors
19:04 More custom errors
23:54 Debug + Display
25:07 Error trait
26:38 From trait
28:07 Testing
29:39 Wrap-up
#rustlang #errorhandling #bestpractice