Hacker News new | ask | show | jobs
by eximius 3326 days ago
I'd expect 'on_error' to take a function as a callback, not a string. But yes, a better named function could be added
3 comments

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("") ?
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.
You're expecting specific errors.