From: "trans (Thomas Sawyer)" Date: 2012-04-28T21:05:42+09:00 Subject: [ruby-core:44730] [ruby-trunk - Feature #6372] More specific error for uncaught throw Issue #6372 has been updated by trans (Thomas Sawyer). > Because you didn't explain use case at all, I didn't understand the spec of your code nor what you really want. You are talking about tests, right? Yes, that's the general use case. Also, I thought my code was correct and so covered the "spec" with the exception of said error. Turns out it had a bug though. I see what you are saying. Obviously there can't be a special exceptions for every minutia of error. I think this is a good candidate though in that most, if not every, assertion framework I have seen has basically the same test for this. Looked at MiniTest's assertion for comparison https://github.com/seattlerb/minitest/blob/master/lib/minitest/unit.rb#L412) and it has the same issue. ---------------------------------------- Feature #6372: More specific error for uncaught throw https://bugs.ruby-lang.org/issues/6372#change-26291 Author: trans (Thomas Sawyer) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: 2.0.0 I have this method: =begin class Symbol # Does the block throw the symbol? # def thrown? catch(self) do begin yield true rescue ArgumentError => err # 1.9 exception false rescue NameError => err # 1.8 exception false end end end end =end But it was recently pointed out to me that the rescue of ArgumentError and NameError is not good enough b/c they might rescue an unrelated error of the same type. So to make this right there needs to be a more specific error. Perhaps `class ThrowError < ArgumentError`. -- http://bugs.ruby-lang.org/