Re:My Struggles with Rust
by eximius on Sunday May 07, 2017 @11:25AM
(#14285877)
I'd expect 'on_error' to take a function as a callback, not a string. But yes, a better named function could be added
[ Parent
| on HN ]
Perhaps or_die, similar to Perl?
Yep, this is what I always wanted it to be! But maybe or_panic would be better. Naming things is hard.
or_fail_with("") ?
Re:My Struggles with Rust
by eternalban on Sunday May 07, 2017 @03:31PM
(#14287131)
expect[ing_error]("could not open the file")
You're not expecting an error. On the contrary, you're expecting a value or throwing an error.
Re:My Struggles with Rust
by eternalban on Tuesday May 09, 2017 @08:32AM
(#14299425)
You're expecting specific errors.