Project

General

Profile

Feature #11650

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

Now Timeout.timeout can accept custom error message: 

 ~~~ruby ~~~ 
 Timeout.timeout(30, CustomException, “custom_message”) 
 ~~~ 

 This option might be useful for networking: 

 ~~~ruby ~~~ 
 # net/smtp.rb#do_start 
 Timeout.timeout(30, Net::OpenTimeout, "failed to open #{host}") do 
   tcp_connection 
 end 
 ~~~

Back