summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/error.c b/error.c
index 42f83682ea..834eede8af 100644
--- a/error.c
+++ b/error.c
@@ -812,6 +812,21 @@ rb_name_error(ID id, const char *fmt, ...)
rb_exc_raise(exc);
}
+void
+rb_name_error_str(VALUE str, const char *fmt, ...)
+{
+ VALUE exc, argv[2];
+ va_list args;
+
+ va_start(args, fmt);
+ argv[0] = rb_vsprintf(fmt, args);
+ va_end(args);
+
+ argv[1] = str;
+ exc = rb_class_new_instance(2, argv, rb_eNameError);
+ rb_exc_raise(exc);
+}
+
/*
* call-seq:
* NameError.new(msg [, name]) -> name_error