about summary refs log tree commit homepage
path: root/ext/kgio/tryopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/tryopen.c')
-rw-r--r--ext/kgio/tryopen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/kgio/tryopen.c b/ext/kgio/tryopen.c
index 1d097c7..50bacf4 100644
--- a/ext/kgio/tryopen.c
+++ b/ext/kgio/tryopen.c
@@ -171,7 +171,13 @@ void init_kgio_tryopen(void)
                 switch (TYPE(err)) {
                 case T_SYMBOL: const_id = SYM2ID(err); break;
                 case T_STRING: const_id = rb_intern(RSTRING_PTR(err)); break;
-                default: rb_bug("constant not a symbol or string");
+                default: {
+                        VALUE i = rb_inspect(err);
+                        const char *s = RSTRING_PTR(i);
+
+                        rb_bug("constant not a symbol or string: %s", s);
+                        RB_GC_GUARD(i);
+                        }
                 }
 
                 error = rb_const_get(rb_mErrno, const_id);