ruby-changes:54316
From: knu <ko1@a...>
Date: Mon, 24 Dec 2018 17:11:54 +0900 (JST)
Subject: [ruby-changes:54316] knu:r66525 (trunk): Document the "cause" keyword argument for raise
knu 2018-12-24 17:11:49 +0900 (Mon, 24 Dec 2018) New Revision: 66525 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66525 Log: Document the "cause" keyword argument for raise Modified files: trunk/eval.c Index: eval.c =================================================================== --- eval.c (revision 66524) +++ eval.c (revision 66525) @@ -706,11 +706,11 @@ extract_raise_opts(int argc, const VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L706 /* * call-seq: * raise - * raise(string) - * raise(exception [, string [, array]]) + * raise(string, cause: $!) + * raise(exception [, string [, array]], cause: $!) * fail - * fail(string) - * fail(exception [, string [, array]]) + * fail(string, cause: $!) + * fail(exception [, string [, array]], cause: $!) * * With no arguments, raises the exception in <code>$!</code> or raises * a <code>RuntimeError</code> if <code>$!</code> is +nil+. @@ -725,6 +725,11 @@ extract_raise_opts(int argc, const VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L725 * * raise "Failed to create socket" * raise ArgumentError, "No parameters", caller + * + * The +cause+ of the generated exception is automatically set to the + * "current" exception (<code>$!</code>) if any. An alternative + * value, either an +Exception+ object or +nil+, can be specified via + * the +:cause+ argument. */ static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/