Rust by Example

16 Error handling

Error handling is the process of handling the possibility of failure. For example, failing to read a file and then continuing to use that bad input would clearly be problematic. Noticing and explicitly managing those errors saves the rest of the program from various pitfalls.

For a more rigorous discussion of error handling, refer to the error handling section in the official book.