module Protobuf::Rpc::Server
def parse_response_from_service(response)
setting it on the pb request, and serializing the
Read out the response from the service method,
def parse_response_from_service(response) expected = @klass.rpcs[@klass][@method].response_type # Cannibalize the response if it's a Hash response = expected.new(response) if response.is_a?(Hash) actual = response.class log_debug "[#{log_signature}] response (should/actual): %s/%s" % [expected.name, actual.name] # Determine if the service tried to change response types on us if expected == actual serialize_response(response) else # response types do not match, throw the appropriate error raise BadResponseProto, 'Response proto changed from %s to %s' % [expected.name, actual.name] end rescue => error log_error error.message log_error error.backtrace.join("\n") handle_error(error) end