为什么Ruby的设计只能通过rescue
隐含地处理StandardError
例外?对于其他例外情况,为什么我们需要明确地使用rescue
?默认情况下,为什么'rescue`不能捕获'StandardError`以外的异常类?
begin
#codes here which may generates exceptions
rescue
#codes to handle some thing which really needed to be done when exceptions there
end
谁能帮我理解它的核心吗?
似乎Ruby的例外已经这样设计,没有什么太多技术性的。好吧,无论如何,'+ 1'也是你。 :) – 2013-02-09 10:00:11
Downvoter:投票没有帮助,没有留下评论,为什么也没有帮助。 – 2013-02-09 10:08:45