Concept Flow - Custom error types
Define struct or enum for error
Implement std::fmt::Display
Implement std::error::Error
Use error type in functions
Return Result<T, CustomError>
Handle error with match or ? operator
End
Create a custom error type by defining a struct or enum, implement Display and Error traits, then use it in functions returning Result to handle errors clearly.
