Hi folks,

I only knows very basic error handing, say
begin
  test1() # test1() will call some api call from other library,
          # if it failed, it will generate some error message
          # and exit the program
rescue
  puts "test1 failed"
end

begin
  test2() # similiar to test1() but different error message
rescue
  puts "test2 failed"
end

This is really tedious.
Is there any other way that I can have only one set of begin/rescue/end?

I am imaging some mechanism like use regex to search the error message
for key word?

thanks,

David

-- 
Posted via http://www.ruby-forum.com/.