class TCellAgent::Rust::NativeAgentResponse
Attributes
errors[R]
response[R]
Public Class Methods
new(native_method_name, response, response_len)
click to toggle source
# File lib/tcell_agent/rust/native_agent_response.rb, line 6 def initialize(native_method_name, response, response_len) @response = {} @errors = [] if response_len < 0 @errors.push( "Error response from `#{native_method_name}` in native library method: #{response_len}" ) return end begin @response = JSON.parse(response.get_string(0, response_len)) if @response['error'] @errors.push( "#{native_method_name} returned an error: #{@response['error']}" ) @response = {} end if @response['errors'] @response['errors'].each do |error| @errors.push( "#{native_method_name} returned an error: #{error}" ) @response = {} end end rescue JSON::ParserError @errors.push( "Could not parse json response from `#{native_method_name}` in native library." ) @response = {} end end