https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112016-02-14T04:21:47ZRuby Issue Tracking SystemRuby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569792016-02-14T04:21:47Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>In JRuby, <code>cause</code> is set just in <code>initialize</code>?</p>
<pre><code>$ jruby -v -e 'raise "a" rescue p RuntimeError.new("b").cause'
jruby 9.1.0.0-SNAPSHOT (2.2.3) 2016-02-14 c08ca7a Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
#<RuntimeError: a>
</code></pre>
<pre><code>$ ruby -v -e 'raise "a" rescue p RuntimeError.new("b").cause'
ruby 2.4.0dev (2016-02-13 trunk 53817) [universal.x86_64-darwin15]
nil
</code></pre> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569802016-02-14T05:12:19Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Yes...the exception inherits current $! only in initialize, and carries it until overwritten.</p> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569822016-02-14T07:19:03Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset r53819.</p>
<hr>
<p>not overwrite cause</p>
<ul>
<li>eval.c (setup_exception): set the cause only if it is explicitly<br>
given or not set yet. [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: raise overwrites exception cause even if exception is not new (Closed)" href="https://bugs.ruby-lang.org/issues/12068">#12068</a>]</li>
</ul> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569832016-02-14T10:17:45Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Thanks, nobu!</p> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569842016-02-14T10:30:57Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>May I backport this change to 2.3? Matz? I believe the original behavior was unintentional and should be fixed.</p> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=569862016-02-14T15:35:53Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN</i> to <i>2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED</i></li></ul><p>Please don't backport to the stable branches by yourself. The branch maintainers (usa and me) will do.</p>
<p>I fill Backport field.<br>
I don't think the existing application depend on this behavior. Any opinions?</p> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=581072016-04-16T19:28:45Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED</i> to <i>2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE</i></li></ul><p>ruby_2_3 r54617 merged revision(s) 53819,53822.</p> Ruby master - Bug #12068: raise overwrites exception cause even if exception is not newhttps://bugs.ruby-lang.org/issues/12068?journal_id=582102016-04-22T05:38:14Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE</i> to <i>2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE, 2.3: DONE</i></li></ul><p>ruby_2_2 r54675 merged revision(s) 53819,53822.</p>