summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorOisin Canty <o.canty@f5.com>2021-07-01 11:16:43 +0000
committerOisin Canty <o.canty@f5.com>2021-07-01 11:16:43 +0000
commit830729a6c5a59615d611575c22516b0fb9dcab3d (patch)
tree1a8a3a4215c23461b0991773789499898e0d3e67 /src
parentcfba69781a18407d5c2020c4e3f3d4fc175a6127 (diff)
downloadunit-830729a6c5a59615d611575c22516b0fb9dcab3d.tar.gz
unit-830729a6c5a59615d611575c22516b0fb9dcab3d.tar.bz2
Ruby: improved logging of exceptions without backtraces.
If an exception was raised with a backtrace of zero length, the nxt_ruby_exception_log() routine would return without logging the exception class and message. This commit fixes the issue.
Diffstat (limited to 'src')
-rw-r--r--src/ruby/nxt_ruby.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index ca14af5b..10935528 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -1069,14 +1069,18 @@ nxt_ruby_exception_log(nxt_unit_request_info_t *req, uint32_t level,
return;
}
+ eclass = rb_class_name(rb_class_of(err));
+
+ msg = rb_funcall(err, rb_intern("message"), 0);
ary = rb_funcall(err, rb_intern("backtrace"), 0);
- if (nxt_slow_path(RARRAY_LEN(ary) == 0)) {
+
+ if (RARRAY_LEN(ary) == 0) {
+ nxt_unit_req_log(req, level, "Ruby: %s (%s)", RSTRING_PTR(msg),
+ RSTRING_PTR(eclass));
+
return;
}
- eclass = rb_class_name(rb_class_of(err));
- msg = rb_funcall(err, rb_intern("message"), 0);
-
nxt_unit_req_log(req, level, "Ruby: %s: %s (%s)",
RSTRING_PTR(RARRAY_PTR(ary)[0]),
RSTRING_PTR(msg), RSTRING_PTR(eclass));