begin and rescue are Ruby's version of try catch. You could alway raise a custom error. The best book on ruby exception handling is this one: http://exceptionalruby.com/