Errors

Learn how to handle errors in Rust.

Most languages handle errors through exceptions, but Rust does it with a type called Result<T, E>. It’s a data type with two generics: T and E. The T type on the left side is used for the return value, and the E is for the error. We need to return it with the Ok and Error function, respectively.

Get hands-on with 1200+ tech skills courses.