From: SASADA Koichi Date: 2017-05-16T10:58:58+09:00 Subject: [ruby-core:81190] Re: [Ruby trunk Bug#13564] Exception message management On 2017/05/15 20:31, eregontp@gmail.com wrote: > I think using Exception#cause for this would be a better way to address this problem. > However, there is a long-standing bug of the cause not being shown in Exception#inspect and neither by the top-level handler: https://bugs.ruby-lang.org/issues/9918 I agree it is one solution. However, to make sure transparency (for `rescue` clause which catch the exception later) we need to provide same error class (`$!.class`). > @ko1: Could you share your use-case? Modifying an exception message in ensure seems unusual to me. > In the test_gem_gem_runner.rb, it seems `rescue Exception` would be more intuitive to handle this (but it has the same problem about modifying the message). My usage is a bit strange. I want to know the status about just before suspicious code (`require 'rubygems/gem_runner'`) and just after this line if $! is not nil. Usually we can show such information on STDERR but test framework (test-all with parallel option) hides all of STDERR output so that we need to show via Exception message. I think such usage is not so frequent so that > Otherwise I think 1-1 + 2 is the best compromise. I think (1) without (2) (with [Feature #9918]) is acceptable. Thanks, Koichi -- // SASADA Koichi at atdot dot net Unsubscribe: