My huge problem with @rustlang currently: nobody shows how to handle errors properly. Every tutorial, every crate's documentation just "blah_blah.unwrap()", which is "generally discouraged" according to Rust docs, Rust book, etc :/
The gopher inside me screams in the agony
-
-
To improve something one needs to understand how to do it properly. The book seems to show several ways to propagate io::Error but no examples of how it should be done when mixed error types occurred on a code path. anyhow crate from the comments here looks like what I'm looking
-
Currently re-re-reading https://blog.burntsushi.net/rust-error-handling/ … and things become more clear now
End of conversation
New conversation -
-
-
I loved the handbook, very thorough and easy to read. Perhaps not that chapter specifically but I would like to see some intermediate level examples.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Mixing error types. The examples only use `io::Error`, which is why `?` works with every statement. What if all statements in a function return different error types? What's the best way to handle that?
-
Create your own error type that implements `From<OtherErrorType>` for each error and the `?` will work
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.