summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-05-26 20:14:18 +0900
committerNobuyoshi Nakada <[email protected]>2024-05-26 20:14:18 +0900
commitbc50f2a3f1d166be3899f32b81bb78f666000592 (patch)
treee29a8598ab348188b94cac94fa7a1a10158c6a74 /error.c
parent0f9e50b8c5554d5a6a3f19044d0c9e276b7d414b (diff)
Debug unexpectedly changed path
Diffstat (limited to 'error.c')
-rw-r--r--error.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/error.c b/error.c
index 5f8111df57..4398019b40 100644
--- a/error.c
+++ b/error.c
@@ -2719,8 +2719,10 @@ syntax_error_with_path(VALUE exc, VALUE path, VALUE *mesg, rb_encoding *enc)
rb_ivar_set(exc, id_i_path, path);
}
else {
- if (rb_attr_get(exc, id_i_path) != path) {
- rb_raise(rb_eArgError, "SyntaxError#path changed");
+ VALUE old_path = rb_attr_get(exc, id_i_path);
+ if (old_path != path) {
+ rb_raise(rb_eArgError, "SyntaxError#path changed: %+"PRIsVALUE"->%+"PRIsVALUE,
+ old_path, path);
}
VALUE s = *mesg = rb_attr_get(exc, idMesg);
if (RSTRING_LEN(s) > 0 && *(RSTRING_END(s)-1) != '\n')