summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/error.c b/error.c
index a4006a14a5..9d3e191523 100644
--- a/error.c
+++ b/error.c
@@ -2226,8 +2226,16 @@ rb_error_frozen(const char *what)
void
rb_error_frozen_object(VALUE frozen_obj)
{
- rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE,
- CLASS_OF(frozen_obj));
+ VALUE path, line;
+ if ((path = rb_iv_get(frozen_obj, "__object_created_path__")) != Qnil &&
+ (line = rb_iv_get(frozen_obj, "__object_created_line__")) != Qnil) {
+ rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
+ CLASS_OF(frozen_obj), path, line);
+ }
+ else {
+ rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE,
+ CLASS_OF(frozen_obj));
+ }
}
#undef rb_check_frozen