https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112013-04-12T04:48:25ZRuby Issue Tracking SystemRuby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=384722013-04-12T04:48:25Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Links to implementation of "cause" rendering and Kernel#raise logic from Rubinius:</p>
<p>"cause" rendering: <a href="https://github.com/rubinius/rubinius/blob/master/kernel/common/exception.rb#L72" class="external">https://github.com/rubinius/rubinius/blob/master/kernel/common/exception.rb#L72</a></p>
<p>Kernel#raise: <a href="https://github.com/rubinius/rubinius/blob/master/kernel/delta/kernel.rb#L27" class="external">https://github.com/rubinius/rubinius/blob/master/kernel/delta/kernel.rb#L27</a></p>
<p>Note that the changes almost exclusively affect rendering of exceptions that bubble out; no other visible aspects of exceptions change with this enhancement. This means that libraries can start using the feature without consumers having to change any code.</p>
<p>This feature would also be useful for associate a low-level cause with higher-level exceptions in core classes and standard library, such as wrapping a low-level IO exception in an SSLError or net/* exception.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=384942013-04-13T00:13:20Zrkh (Konstantin Haase)me@rkh.im
<ul></ul><p>This would indeed be useful. We have built our own solutions for this many times.</p>
<p>Should there also be a mechanism to rescue based on cause that's transparent of wrapping exceptions?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=384972013-04-13T01:03:11Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>rkh (Konstantin Haase) wrote:</p>
<blockquote>
<p>Should there also be a mechanism to rescue based on cause that's transparent of wrapping exceptions?</p>
</blockquote>
<p>Exception::=== could be enhanced to search causes, but I'm dubious about the utility of such an enhancement. It could also make exception-handling slower; even though it's obviously <em>exception</em> handling and doesn't necessarily need to be lightning fast, people still occasionally use it for flow control inappropriately.</p>
<p>I'd probably punt on that one myself and see over time how common it is that people rescue based on causes. I'd suspect it's pretty rare...such a feature has never been considered for Java (as far as I know) even though Java's Throwable has had "cause" forever.</p>
<p>Also want to avoid feature creep. Exception#cause is a nice, simple, low-impact feature as described by me here.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=385422013-04-14T22:33:10Zrkh (Konstantin Haase)me@rkh.im
<ul></ul><p>I think allowing rescue lines to take other objects besides modules would this would greatly ease building something in user code:</p>
<p>def caused_by(matcher)<br>
block = proc do |exception|<br>
matcher === exception or exception.cause && block[exception.cause]<br>
end<br>
end</p>
<p>begin<br>
...<br>
rescue caused_by(NetworkError)<br>
...<br>
end</p>
<p>But I guess that's a separate feature request.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=385772013-04-16T06:03:42Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>rkh (Konstantin Haase) wrote:</p>
<blockquote>
<p>I think allowing rescue lines to take other objects besides modules would this would greatly ease building something in user code:<br>
...<br>
But I guess that's a separate feature request.</p>
</blockquote>
<p>Yeah, it might be nice, but there might also be optimization concerns. You're right though, it should indeed be a separate feature request, and it's certainly applicable to more than just Exception#cause.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=389652013-04-28T07:23:11Zko1 (Koichi Sasada)
<ul></ul><p>(2013/04/12 1:40), headius (Charles Nutter) wrote:</p>
<blockquote>
<ul>
<li>A new set of Kernel#raise overloads that accept (as a trailing argument, probably) the "cause" exception.</li>
</ul>
</blockquote>
<p>(1) introduce new keyword?</p>
<p>example: raise(..., cause: e)</p>
<p>(2) How about to use `$!' forcibly?</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=389662013-04-28T07:23:11Zko1 (Koichi Sasada)
<ul></ul><p>(2013/04/28 7:19), SASADA Koichi wrote:</p>
<blockquote>
<p>(2) How about to use `$!' forcibly?</p>
</blockquote>
<p>because I think Exception#cause= is not cool.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=389772013-04-28T08:23:13Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>On Sat, Apr 27, 2013 at 5:19 PM, SASADA Koichi <a href="mailto:ko1@atdot.net" class="email">ko1@atdot.net</a> wrote:</p>
<blockquote>
<p>(1) introduce new keyword?</p>
<p>example: raise(..., cause: e)</p>
</blockquote>
<p>Yeah, that's not bad. Keywords allow us to avoid changing the<br>
signature in new/incompatible/non-forward-compatible ways.</p>
<blockquote>
<p>(2) How about to use `$!' forcibly?</p>
</blockquote>
<p>Do you mean automatically stick $! into Exception#cause when creating<br>
(or perhaps better, when raising) a new Exception? That's not a bad<br>
idea.</p>
<p>Interestingly, java.lang.Throwable also does not allow setting the<br>
cause. You can set it during init or after init <em>at most once</em>. Here's<br>
JavaDoc for it:<br>
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#initCause(java.lang.Throwable)" class="external">http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#initCause(java.lang.Throwable)</a></p>
<p>I quote: "This method can be called at most once. It is generally<br>
called from within the constructor, or immediately after creating the<br>
throwable. If this throwable was created with Throwable(Throwable) or<br>
Throwable(String,Throwable), this method cannot be called even once."</p>
<p>Java 7 also added an additional mechanism for attaching exceptions,<br>
called "supressed exceptions".<br>
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)" class="external">http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)</a></p>
<p>This mechanism was added for exceptions that are not really the<br>
<em>cause</em>, but which are related. For example, an IO read operation<br>
raises an error, and while handling that error and attempting to close<br>
the stream a second error is raised. The read error did not cause the<br>
close error, but you don't want to lose either. You raise the close<br>
error with the read error attached as "suppressed".</p>
<p>I think for purposes of this feature, adding cause, which can be<br>
initialized during construction only, would be sufficient. I have no<br>
strong opinion about automatically using $! as the cause, but it might<br>
be nice.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=389782013-04-28T08:23:13Zko1 (Koichi Sasada)
<ul></ul><p>(2013/04/28 7:59), Charles Oliver Nutter wrote:</p>
<blockquote>
<blockquote>
<blockquote>
<p>(2) How about to use `$!' forcibly?<br>
Do you mean automatically stick $! into Exception#cause when creating<br>
(or perhaps better, when raising) a new Exception? That's not a bad<br>
idea.</p>
</blockquote>
</blockquote>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>I think for purposes of this feature, adding cause, which can be<br>
initialized during construction only, would be sufficient. I have no<br>
strong opinion about automatically using $! as the cause, but it might<br>
be nice.</p>
</blockquote>
<p>Cool.</p>
<p>Summary:<br>
(1) raise method captures $! as @cause.<br>
(2) Adding new method Exception#cause returns @cause.</p>
<ul>
<li>I'm not sure #cause is good name.<br>
Too short?</li>
</ul>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=390172013-04-29T04:23:14Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>On Sat, Apr 27, 2013 at 6:09 PM, SASADA Koichi <a href="mailto:ko1@atdot.net" class="email">ko1@atdot.net</a> wrote:</p>
<blockquote>
<p>Summary:<br>
(1) raise method captures $! as @cause.<br>
(2) Adding new method Exception#cause returns @cause.</p>
<ul>
<li>I'm not sure #cause is good name.<br>
Too short?</li>
</ul>
</blockquote>
<p>It seems ok to me, since Java's Throwable uses the same name (but I am<br>
perhaps a bit biased.</p>
<p>.NET's Exception calls it the BaseException, via GetBaseException. I<br>
think "base" or "base_exception" not as good as "cause".</p>
<p>I guess the next step is a patch.</p>
<ul>
<li>Charlie</li>
</ul> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=390332013-04-29T16:23:28Zrkh (Konstantin Haase)me@rkh.im
<ul></ul><p>I love the idea of having $! be the cause. It would also mean instant adoption.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=420362013-09-27T20:04:41Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Any further comments here? I might be able to do part of the implementation, but I don't know how to automatically stick $! into cause. I'd like to see this in 2.1.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=421212013-10-01T09:39:15Zheadius (Charles Nutter)headius@headius.com
<ul><li><strong>Target version</strong> set to <i>Ruby 2.1.0</i></li></ul> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=421352013-10-01T16:54:38Zko1 (Koichi Sasada)
<ul><li><strong>Assignee</strong> set to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>I'm positive about this feature.</p>
<p>Matz, what do you think about?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=423732013-10-09T22:27:29Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>Hi,</p>
<ul>
<li>Fundamentally accepted.</li>
<li>I am against #cause=</li>
<li>It's OK that #raise to have cause: keyword argument to specify cause</li>
<li>I am not sure automagical capturing of $! would not cause wrong capturing or not</li>
</ul>
<p>Matz.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=423842013-10-10T00:28:13Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>matz (Yukihiro Matsumoto) wrote:</p>
<blockquote>
<ul>
<li>Fundamentally accepted.</li>
</ul>
</blockquote>
<p>Hooray!</p>
<blockquote>
<ul>
<li>I am against #cause=</li>
</ul>
</blockquote>
<p>java.lang.Throwable does not have #setCause, so I agree. It does have #initCause, which can only be called once (if cause has not already been provided via constructor)...but I have never used it.</p>
<blockquote>
<ul>
<li>It's OK that #raise to have cause: keyword argument to specify cause</li>
</ul>
</blockquote>
<p>Agreed. Unfortunately this would still break backward-compatibility, since it will count as an extra argument on older Ruby versions. This might be the biggest justification for $! capturing.</p>
<blockquote>
<ul>
<li>I am not sure automagical capturing of $! would not cause wrong capturing or not</li>
</ul>
</blockquote>
<p>There are a few small risks:</p>
<ul>
<li>Many layers of exceptions being raised as an error propagates out would all be chained. This could cause more information/data/memory than necessary to be retained.</li>
<li>Lower layers may not want higher layers to have access to the causing error for security or encapsulation reasons.</li>
<li>Too much magic?</li>
</ul>
<p>But I think the benefits may outweigh them:</p>
<ul>
<li>I can't think of any concrete examples of the above risks.</li>
<li>Automatic adoption; all exceptions caused by other exceptions will immediately show their lineage.</li>
<li>Reduced backward incompatibility (other than adding #cause) since users won't have to use the constructor to capture cause exception (of course, I still think we should have the cause constructor too).</li>
</ul>
<p>I think the output of exception backtraces should also be enhanced to show cause exception's trace, as in the JVM. This could cause a problem for tools that parse the backtrace, though (IMO nobody should ever parse backtraces and expect that to be stable).</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=428382013-11-10T23:55:35Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Automagically captured exceptions doesn't feel `cause' to me, now.<br>
It might be irrelevant to the previously rescued exception.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=428862013-11-13T03:32:47Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>nobu (Nobuyoshi Nakada) wrote:</p>
<blockquote>
<p>Automagically captured exceptions doesn't feel `cause' to me, now.<br>
It might be irrelevant to the previously rescued exception.</p>
</blockquote>
<p>That's true, but will that be the exception or the rule? It seems to me that most "hidden" or "suppressed" exceptions will be direct triggers for the actually-raised exception.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=428912013-11-13T08:04:14Zhenry.maddocks (Henry Maddocks)hmaddocks@me.com
<ul></ul><p>How is this different to 'wrapping' an exception? Eg.</p>
<p><a href="http://www.jayway.com/2011/05/25/ruby-an-exceptional-language/" class="external">http://www.jayway.com/2011/05/25/ruby-an-exceptional-language/</a></p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=428922013-11-13T08:46:21Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>henry.maddocks (Henry Maddocks) wrote:</p>
<blockquote>
<p>How is this different to 'wrapping' an exception? Eg.</p>
<p><a href="http://www.jayway.com/2011/05/25/ruby-an-exceptional-language/" class="external">http://www.jayway.com/2011/05/25/ruby-an-exceptional-language/</a></p>
</blockquote>
<p>Not much different, but built-in and automatically available.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=431782013-11-27T05:57:03Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>I think we still need to add Exception.new(:cause => ex) to allow constructing an exception with a <em>specific</em> cause. The $! capturing is great but often there may be more than one exception in play.</p>
<p>This needs to happen before 2.1 final.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=434952013-12-07T21:14:54Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>What about the backward compatibility?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=435412013-12-09T15:09:57Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>nobu: Because :cause is opt-in, I am not concerned about the backward compat. You'd have to be committing to 2.1 in order to start using that feature, and I think it will be slow to adopt in any case.</p>
<p>It would also be possible to monkey-patch older versions to just ignore the options.</p>
<p>I think we should add the option for future use, because it <em>is</em> needed, and we have to add it some time.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=435742013-12-10T23:24:21Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Carelessly, I implemented <code>raise cause: ex</code> but not <code>Exception.new(cause: ex)</code>, and nearly committed it.<br>
Do you prefer the latter?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=435982013-12-11T13:23:17Zko1 (Koichi Sasada)
<ul></ul><p>(2013/12/10 23:24), nobu (Nobuyoshi Nakada) wrote:</p>
<blockquote>
<p>Carelessly, I implemented <code>raise cause: ex</code> but not <code>Exception.new(cause: ex)</code>, and nearly committed it.<br>
Do you prefer the latter?</p>
</blockquote>
<p>How about to simply add Exception#cause= only?</p>
<p>This is because:</p>
<ul>
<li>
<p>Setting "cause" is not common usecase (nobody care about it)<br>
Some long steps such as<br>
e = Exception.new(...)<br>
e.cause =...<br>
raise e"<br>
is acceptable for unusual cases.</p>
</li>
<li>
<p>No compatibility issue with raise()</p>
</li>
</ul>
<p>However, matz is against "cause=" by <a href="/issues/8257">[ruby-core:57773]</a>.<br>
Because he doesn't want to introduce any states.<br>
I also agree this point.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436112013-12-11T20:09:26Zrosenfeld (Rodrigo Rosenfeld Rosas)rr.rosas@gmail.com
<ul></ul><p>Actually, the only reason I don't use it is because it's not possible, but I'd most probably always send along the cause if this was supported, so I prefer a concise way to do that.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436122013-12-11T20:14:24Zrosenfeld (Rodrigo Rosenfeld Rosas)rr.rosas@gmail.com
<ul></ul><p>And sometimes a Runtime exception would be fine to me, so <code>raise "Some explanation", cause: ex</code> would be great, but sometimes I need to wrap the original exception in some specific one. In that latter case, I'd prefer to be able to specify the cause with <code>CustomException.new("message", cause: ex)</code>. I'm usually interested in keeping the full backtrace in a simple way when doing that...</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436132013-12-11T21:08:52Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>rosenfeld (Rodrigo Rosenfeld Rosas) wrote:</p>
<blockquote>
<p>sometimes I need to wrap the original exception in some specific one.</p>
</blockquote>
<p>Just wrapping in a new exception but don't raise it?<br>
How frequent is such case?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436152013-12-12T00:28:08Zrosenfeld (Rodrigo Rosenfeld Rosas)rr.rosas@gmail.com
<ul></ul><p>Yes, raising it too.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436162013-12-12T00:33:21Zrosenfeld (Rodrigo Rosenfeld Rosas)rr.rosas@gmail.com
<ul></ul><p>I believe you think I should write this instead:</p>
<p>raise WrappedException.new("message"), cause: ex</p>
<p>I wouldn't mind doing that but if I ever had to store the exception without raising it then it wouldn't be possible to do so, right? But in that case I could also store the cause separately, so it isn't really a big deal.</p>
<p>I wouldn't mind to add cause just to raise...</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=436232013-12-12T17:00:08Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>rosenfeld (Rodrigo Rosenfeld Rosas) wrote:</p>
<blockquote>
<p>I believe you think I should write this instead:</p>
<p>raise WrappedException.new("message"), cause: ex</p>
</blockquote>
<p>I think this is more common in ruby:<br>
<code>raise WrappedException, "message", cause: ex</code></p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=438982013-12-26T05:23:33Zavdi (Avdi Grimm)avdi@avdi.codes
<ul></ul><p>I've been digging into this feature now that 2.1 is released, and I'm a<br>
little confused. In the final implementation, can #cause only be set from<br>
$!? None of the other methods for setting the cause discussed in this<br>
thread seem to work, and for that matter I don't see any changes to the<br>
#raise or Exception#initialize methods to support explicitly setting a<br>
cause.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=439382013-12-30T00:19:18Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>Unfortunately it doesn't look like anything other than $! logic for this made it into 2.1. I was hoping we'd get either the constructor or a one-time-only #cause= but there was still some debate about which way to go.</p>
<p>Since the base #cause and $! logic made it in, perhaps we should call this bug closed as of 2.1 and add a new bug for additional ways to initialize the exception cause.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=448912014-02-02T15:10:52ZEregon (Benoit Daloze)
<ul></ul><p><code>raise ErrorClass, msg, cause: cause</code> was implemented with the rest in r44473.</p>
<pre><code>e = (
begin
raise ArgumentError, "arg error"
rescue
nie = NotImplementedError.new("nie")
raise StandardError, "stderr", cause: nie
end) rescue $!
e.cause # => #<NotImplementedError: nie>
</code></pre>
<p>But the cause is not shown in the error output, which I think is now the most important step forward.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=449592014-02-05T03:48:31Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/9338">Bug #9338</a>: Build failure of trunk with MSVC 2013</i> added</li></ul> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=472542014-06-17T02:34:14Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>Vagrant hits the incompatibility:<br>
<a href="https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/driver/base.rb#L347" class="external">https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/driver/base.rb#L347</a></p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="k">raise</span> <span class="no">Vagrant</span><span class="o">::</span><span class="no">Errors</span><span class="o">::</span><span class="no">VBoxManageError</span><span class="p">,</span>
<span class="ss">:command</span> <span class="o">=></span> <span class="n">command</span><span class="p">.</span><span class="nf">inspect</span><span class="p">,</span>
<span class="ss">:stderr</span> <span class="o">=></span> <span class="n">r</span><span class="p">.</span><span class="nf">stderr</span>
</code></pre>
<p>it raies ArgumentError: unknown keyword: command, stderr.</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=472552014-06-17T03:37:55Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset ruby-trunk:r46456.</p>
<hr>
<p>eval.c: pass unknown options</p>
<ul>
<li>eval.c (extract_raise_opts): pass unknown options to the<br>
exception, so that exception class can receive a hash argument.<br>
<a href="/issues/8257">[ruby-core:63203]</a> [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Exception#cause to carry originating exception along with new one (Closed)" href="https://redmine.ruby-lang.org/issues/8257">#8257</a>]</li>
</ul> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=479392014-07-20T20:20:13Zheadius (Charles Nutter)headius@headius.com
<ul></ul><p>I agree with Benoit that the cause exception should be reflected in the error output, as on the JVM. What are the objections?</p>
<p>I do <em>not</em> believe this should show up in #backtrace since I have no idea how it would be formatted. This also lines up with the JVM (printStackTrace and friends print cause, but getStackTrace only returns trace for target exception).</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=479472014-07-21T13:23:12Zko1 (Koichi Sasada)
<ul></ul><p>(2014/07/21 1:50), <a href="mailto:headius@headius.com" class="email">headius@headius.com</a> wrote:</p>
<blockquote>
<p>I agree with Benoit that the cause exception should be reflected in the error output, as on the JVM. What are the objections?</p>
</blockquote>
<p>What happen on exception from deep backtrace, occurred by other more<br>
deeper exception? Show all long two backtraces?</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=684802017-12-18T00:35:07Zpeterfaiman (Peter Faiman)
<ul></ul><p>Is there a reason not to do caused-by stack trace printing? Or has it just not been implemented by anyone yet?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=685662017-12-20T17:35:32ZEregon (Benoit Daloze)
<ul></ul><p>ko1 (Koichi Sasada) wrote:</p>
<blockquote>
<p>What happen on exception from deep backtrace, occurred by other more<br>
deeper exception? Show all long two backtraces?</p>
</blockquote>
<p>Yes, although we can omit the common part of the backtrace in the cause backtraces like in Java:<br>
<a href="http://www.codejava.net/java-core/exception/understanding-exception-stack-trace-in-java-with-code-examples" class="external">http://www.codejava.net/java-core/exception/understanding-exception-stack-trace-in-java-with-code-examples</a></p>
<p>peterfaiman (Peter Faiman) wrote:</p>
<blockquote>
<p>Is there a reason not to do caused-by stack trace printing? Or has it just not been implemented by anyone yet?</p>
</blockquote>
<p>I believe it was just no implemented yet.<br>
<a class="user active user-mention" href="https://redmine.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a> Who should we assign this to?</p> Ruby master - Feature #8257: Exception#cause to carry originating exception along with new onehttps://redmine.ruby-lang.org/issues/8257?journal_id=955382021-12-23T23:41:08Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<ul><li><strong>Project</strong> changed from <i>14</i> to <i>Ruby master</i></li><li><strong>Target version</strong> deleted (<del><i>Ruby 2.1.0</i></del>)</li></ul>