diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb index cee8cb3..1d2b193 100644 --- a/bootstraptest/test_io.rb +++ b/bootstraptest/test_io.rb @@ -26,7 +26,7 @@ assert_finish 10, %q{ t1.join t2.join end - rescue LoadError, TimeoutError, NotImplementedError + rescue LoadError, Timeout::Error, NotImplementedError end }, '[ruby-dev:32566]' diff --git a/doc/ChangeLog-1.9.3 b/doc/ChangeLog-1.9.3 index e9ede64..51d9c5e 100644 --- a/doc/ChangeLog-1.9.3 +++ b/doc/ChangeLog-1.9.3 @@ -26632,7 +26632,7 @@ Sat Jun 13 07:06:54 2009 Nobuyoshi Nakada Sat Jun 13 06:50:31 2009 Nobuyoshi Nakada - * lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): TimeoutError is + * lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): Timeout::Error is obsolete, use Timeout::Error instead. [ruby-core:23821] Sat Jun 13 06:45:46 2009 Nobuyoshi Nakada diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 6b452b8..c64bb5c 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -103,7 +103,7 @@ module Net # Number of seconds to wait for one block to be read (via one read(2) # call). Any number may be used, including Floats for fractional # seconds. If the FTP object cannot read data in this many seconds, - # it raises a TimeoutError exception. The default value is 60 seconds. + # it raises a Timeout::Error exception. The default value is 60 seconds. attr_reader :read_timeout # Setter for the read_timeout attribute. diff --git a/lib/resolv.rb b/lib/resolv.rb index 9c7dd1b..293e559 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -158,7 +158,7 @@ class Resolv ## # Indicates a timeout resolving a name or address. - class ResolvTimeout < TimeoutError; end + class ResolvTimeout < Timeout::Error; end ## # Resolv::Hosts is a hostname resolver that uses the system hosts file. diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 4dfaee9..6aa2d1c 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -521,7 +521,7 @@ module WEBrick } rescue Errno::ECONNRESET return nil - rescue TimeoutError + rescue Timeout::Error raise HTTPStatus::RequestTimeout end end diff --git a/sample/timeout.rb b/sample/timeout.rb index 2870ddb..8d25d72 100644 --- a/sample/timeout.rb +++ b/sample/timeout.rb @@ -8,7 +8,7 @@ end p timeout(5) { 45 } -p timeout(5, TimeoutError) { +p timeout(5, Timeout::Error) { 45 } p timeout(nil) { diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index 4f12db5..da44a96 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -190,10 +190,10 @@ module DRbCore def test_06_timeout ten = Onecky.new(10) - assert_raise(TimeoutError) do + assert_raise(Timeout::Error) do @there.do_timeout(ten) end - assert_raise(TimeoutError) do + assert_raise(Timeout::Error) do @there.do_timeout(ten) end end diff --git a/test/ruby/test_readpartial.rb b/test/ruby/test_readpartial.rb index b969c38..7f2ec65 100644 --- a/test/ruby/test_readpartial.rb +++ b/test/ruby/test_readpartial.rb @@ -50,7 +50,7 @@ class TestReadPartial < Test::Unit::TestCase w << 'abc' assert_equal('ab', r.readpartial(2)) assert_equal('c', r.readpartial(2)) - assert_raise(TimeoutError) { + assert_raise(Timeout::Error) { timeout(0.1) { r.readpartial(2) } } } @@ -64,7 +64,7 @@ class TestReadPartial < Test::Unit::TestCase assert_equal("de", r.readpartial(2)) assert_equal("f\n", r.readpartial(4096)) assert_equal("ghi\n", r.readpartial(4096)) - assert_raise(TimeoutError) { + assert_raise(Timeout::Error) { timeout(0.1) { r.readpartial(2) } } } diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb index 6a33977..4f495cc 100644 --- a/test/thread/test_queue.rb +++ b/test/thread/test_queue.rb @@ -239,7 +239,7 @@ class TestQueue < Test::Unit::TestCase th1.raise sleep 0.1 q << :s - assert_nothing_raised(TimeoutError) do + assert_nothing_raised(Timeout::Error) do timeout(1) { th2.join } end ensure diff --git a/thread.c b/thread.c index 4365c1f..aedd0c1 100644 --- a/thread.c +++ b/thread.c @@ -1731,29 +1731,29 @@ handle_interrupt_arg_check_i(VALUE key, VALUE val) * resource allocation code. Then, the ensure block is where we can safely * deallocate your resources. * - * ==== Guarding from TimeoutError + * ==== Guarding from Timeout::Error * - * In the next example, we will guard from the TimeoutError exception. This - * will help prevent from leaking resources when TimeoutError exceptions occur + * In the next example, we will guard from the Timeout::Error exception. This + * will help prevent from leaking resources when Timeout::Error exceptions occur * during normal ensure clause. For this example we use the help of the * standard library Timeout, from lib/timeout.rb * * require 'timeout' - * Thread.handle_interrupt(TimeoutError => :never) { + * Thread.handle_interrupt(Timeout::Error => :never) { * timeout(10){ - * # TimeoutError doesn't occur here - * Thread.handle_interrupt(TimeoutError => :on_blocking) { - * # possible to be killed by TimeoutError + * # Timeout::Error doesn't occur here + * Thread.handle_interrupt(Timeout::Error => :on_blocking) { + * # possible to be killed by Timeout::Error * # while blocking operation * } - * # TimeoutError doesn't occur here + * # Timeout::Error doesn't occur here * } * } * - * In the first part of the +timeout+ block, we can rely on TimeoutError being - * ignored. Then in the TimeoutError => :on_blocking block, any + * In the first part of the +timeout+ block, we can rely on Timeout::Error being + * ignored. Then in the Timeout::Error => :on_blocking block, any * operation that will block the calling thread is susceptible to a - * TimeoutError exception being raised. + * Timeout::Error exception being raised. * * ==== Stack control settings *