I have 10 Ruby function calls I’d like to execute and each call could possibly throw an exception. I’d like to handle each exception the same way and continue. Is there a way to do this without wrapping each line in a begin … rescue … end block?
[Edit]: Use case for this is a screen scraper/automation tool that uses the Selenium web driver to fill out forms. I don’t want to bother checking if options in select elements exist, just fill them out as good as possible. for this, I need to call Selenium::WebDriver::Support::Select.select_by and continue if it throws a “cannot locate option with value x” exception.
You mean something like this ?
Edit: added more code to the example