aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-21 16:57:25 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-21 16:57:25 -0700
commitc6b1a71fc2a7d7ab67e791499c9e3dfd4621abf2 (patch)
tree2743af990c61317463a4d2214ebc6ff2ade0ba06 /src
parent795a50fc7175a4abbd991cbd806718ac52c461e9 (diff)
parent2c247433b8d3c4c2fe0105f024ffc1437f8993e6 (diff)
Merge pull request #5490 from murgatroid99/ruby_call_credentials_log_error
Add error output for failed ruby credentials plugin
Diffstat (limited to 'src')
-rw-r--r--src/ruby/ext/grpc/rb_call_credentials.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c
index 2426f106a9..c7697f4628 100644
--- a/src/ruby/ext/grpc/rb_call_credentials.c
+++ b/src/ruby/ext/grpc/rb_call_credentials.c
@@ -41,6 +41,7 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include "rb_call.h"
#include "rb_event_thread.h"
@@ -81,14 +82,23 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
VALUE exception_object) {
VALUE result = rb_hash_new();
+ VALUE backtrace = rb_funcall(
+ rb_funcall(exception_object, rb_intern("backtrace"), 0),
+ rb_intern("join"),
+ 1, rb_str_new2("\n\tfrom "));
+ VALUE exception_info = rb_funcall(exception_object, rb_intern("to_s"), 0);
+ const char *exception_classname = rb_obj_classname(exception_object);
(void)args;
+ gpr_log(GPR_INFO, "Call credentials callback failed: %s: %s\n%s",
+ exception_classname, StringValueCStr(exception_info),
+ StringValueCStr(backtrace));
rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
/* Currently only gives the exception class name. It should be possible get
more details */
rb_hash_aset(result, rb_str_new2("status"),
INT2NUM(GRPC_STATUS_PERMISSION_DENIED));
rb_hash_aset(result, rb_str_new2("details"),
- rb_str_new2(rb_obj_classname(exception_object)));
+ rb_str_new2(exception_classname));
return result;
}