Comment
Comment by slx26
yeah, I kinda agree. at least in Ruby, besides the errors bubbling up, if you had to handle the error manually, you could use the truthiness of the language to write just:
I've read the other proposals, and in fact one of them (catch) is similar to what I do when I'm coding just for myself:
where the code for exit_on_error is simply something like:
you could make it a bit more robust:
where ERROR_FILE_OPEN could be a simple constant, and in the method we have a switch with constants and messages. not a zero cost abstraction, but if you have to handle an error, it probably wasn't a cheap operation either, so the extra call won't be an issue