[前][次][番号順一覧][スレッド一覧]

ruby-changes:36379

From: nobu <ko1@a...>
Date: Sun, 16 Nov 2014 19:11:26 +0900 (JST)
Subject: [ruby-changes:36379] nobu:r48460 (trunk): timeout.rb: use UncaughtThrowError

nobu	2014-11-16 19:11:08 +0900 (Sun, 16 Nov 2014)

  New Revision: 48460

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48460

  Log:
    timeout.rb: use UncaughtThrowError
    
    * lib/timeout.rb (Timeout::ExitException#exception): rescue
      UncaughtThrowError which is specific for throw, instead of
      ArgumentError.

  Modified files:
    trunk/ChangeLog
    trunk/lib/timeout.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48459)
+++ ChangeLog	(revision 48460)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Nov 16 19:11:04 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/timeout.rb (Timeout::ExitException#exception): rescue
+	  UncaughtThrowError which is specific for throw, instead of
+	  ArgumentError.
+
 Sun Nov 16 18:22:18 2014  Eric Wong  <e@8...>
 
 	* tool/update-deps: warning to disable ccache
Index: lib/timeout.rb
===================================================================
--- lib/timeout.rb	(revision 48459)
+++ lib/timeout.rb	(revision 48460)
@@ -40,8 +40,7 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb#L40
         bt = caller
         begin
           throw(self, bt)
-        rescue ArgumentError => e
-          raise unless e.message.start_with?("uncaught throw")
+        rescue UncaughtThrowError
           raise Error, message, backtrace
         end
       end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]