summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-24 08:11:49 (GMT)
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-24 08:11:49 (GMT)
commite69dbc09618cb3f445e6d936800cea097e6133b7 (patch)
treeaee8e5ac798f707bbc4a198f5d8bc00dcfbf018c
parent72c62dc0865ef572f8502bcb1c8b6309869a162e (diff)
Document the "cause" keyword argument for raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--eval.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index e0eb5c5..e43d980 100644
--- a/eval.c
+++ b/eval.c
@@ -706,11 +706,11 @@ extract_raise_opts(int argc, const VALUE *argv, VALUE *opts)
/*
* 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 *argv, VALUE *opts)
*
* 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