aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-05-27 17:52:35 -0700
committerJeremy Evans <code@jeremyevans.net>2019-06-04 19:25:03 -0700
commitf1f04caf60e4fc9dc3b12109e0be831f2d692810 (patch)
tree0e6eba1746bc641b74db760133c794f7b466a4f1 /error.c
parent96d65274246a4be88581693f452e6b3bae9fdc5c (diff)
downloadruby-f1f04caf60e4fc9dc3b12109e0be831f2d692810.tar.gz
Include inspect value of object in FrozenError messages
FrozenError#receiver was added recently for getting the related object programmatically. However, there are cases where FrozenError is raised and not handled, and in those cases the resulting error messages lack detail, which makes debugging the error more difficult, especially in cases where the error is not easily reproducible. This includes the inspect value of the frozen object in FrozenError messages, which should make debugging simpler.
Diffstat (limited to 'error.c')
-rw-r--r--error.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/error.c b/error.c
index 98b8c7801a..fc9cf7ee24 100644
--- a/error.c
+++ b/error.c
@@ -2897,13 +2897,13 @@ rb_error_frozen_object(VALUE frozen_obj)
VALUE path = rb_ary_entry(debug_info, 0);
VALUE line = rb_ary_entry(debug_info, 1);
- rb_frozen_error_raise(frozen_obj,
- "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
- CLASS_OF(frozen_obj), path, line);
+ rb_frozen_error_raise(frozen_obj,
+ "can't modify frozen %"PRIsVALUE": %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE,
+ CLASS_OF(frozen_obj), rb_inspect(frozen_obj), path, line);
}
else {
- rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE,
- CLASS_OF(frozen_obj));
+ rb_frozen_error_raise(frozen_obj, "can't modify frozen %"PRIsVALUE": %"PRIsVALUE,
+ CLASS_OF(frozen_obj), rb_inspect(frozen_obj));
}
}