Return-value error handling reports success or failure through returned values instead of exceptions. Rust uses Result<T, E>, making both outcomes explicit. section 5.2
A Result-based implementation supports:
- Matching Ok(T) and Err(E) to handle successful and failed computations. section 5.2
- Using the ? operator to propagate errors while reducing match boilerplate. section 5.2
Parsing and serving errors
A square function returns Ok(4) for "2" and Err(ParseIntError) for "INVALID". An Actix Web handler similarly returns Result<HttpResponse, Error>; opening a missing file propagates an operating-system error instead of returning a success response.
