diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-05-30 19:05:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-05-30 19:05:52 +0900 |
commit | 949fabe4e9f60428753e280c7fbc22884d3735b8 (patch) | |
tree | 7ebbd5850ce23945ef380b940b7b2586bf8d8d6d /error.c | |
parent | bc6860db23b0df3bce09378605a618b677dd6d89 (diff) |
[DEBUG] More info when SyntaxError#path changed
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -2721,8 +2721,16 @@ syntax_error_with_path(VALUE exc, VALUE path, VALUE *mesg, rb_encoding *enc) else { 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); + if (rb_str_equal(path, old_path)) { + rb_raise(rb_eArgError, "SyntaxError#path changed: %+"PRIsVALUE" (%p->%p)", + old_path, (void *)old_path, (void *)path); + } + else { + rb_raise(rb_eArgError, "SyntaxError#path changed: %+"PRIsVALUE"(%s%s)->%+"PRIsVALUE"(%s)", + old_path, rb_enc_name(rb_enc_get(old_path)), + (FL_TEST(old_path, RSTRING_FSTR) ? ":FSTR" : ""), + path, rb_enc_name(rb_enc_get(path))); + } } VALUE s = *mesg = rb_attr_get(exc, idMesg); if (RSTRING_LEN(s) > 0 && *(RSTRING_END(s)-1) != '\n') |