class Gruf::Errors::DebugInfo
Represents debugging information for an exception that occurred in a gRPC service
Attributes
detail[R]
@return [String] The detail message of the exception
stack_trace[R]
@return [Array<String>] The stack trace generated by the exception as an array of strings
Public Class Methods
new(detail, stack_trace = [])
click to toggle source
@param [String] detail The detail message of the exception @param [Array<String>] stack_trace
The stack trace generated by the exception as an array of strings
# File lib/gruf/errors/debug_info.rb, line 33 def initialize(detail, stack_trace = []) @detail = detail @stack_trace = (stack_trace.is_a?(String) ? stack_trace.split("\n") : stack_trace) # Limit the size of the stack trace to reduce risk of overflowing metadata stack_trace_limit = Gruf.backtrace_limit.to_i stack_trace_limit = 10 if stack_trace_limit.negative? @stack_trace = @stack_trace[0..stack_trace_limit] if stack_trace_limit.positive? end
Public Instance Methods
to_h()
click to toggle source
Return this object marshalled into a hash
@return [Hash] The debug info represented as a hash
# File lib/gruf/errors/debug_info.rb, line 48 def to_h { detail: detail, stack_trace: stack_trace } end