Y
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
skybrian
3326 days ago
Perhaps or_die, similar to Perl?
link
sanderjd
3326 days ago
Yep, this is what I always wanted it to be! But maybe or_panic would be better. Naming things is hard.
link
allan_s
3324 days ago
or_fail_with("") ?
link
eternalban
3326 days ago
expect[ing_error]("could not open the file")
link
rootlocus
3326 days ago
You're not expecting an error. On the contrary, you're expecting a value
or
throwing an error.
link
eternalban
3324 days ago
You're expecting specific errors.
link