# # Autogenerated by Thrift Compiler (2.4.0-upfluence) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # require 'thrift' require 'debug_proto_test_types' module ServiceForExceptionWithAMap SERVICE = 'ServiceForExceptionWithAMap'.freeze NAMESPACE = ''.freeze class Client def initialize(client) @client = ::Thrift.build_client(client) end def self.from_provider(provider) Client.new(provider.build(NAMESPACE, SERVICE)) end def methodThatThrowsAnException() result = @client.call_binary( 'methodThatThrowsAnException', MethodThatThrowsAnException_args.new(), MethodThatThrowsAnException_result ) raise result.xwamap unless result.xwamap.nil? nil end end class Processor include ::Thrift::Processor def self.from_provider(handler, provider) provider.build(NAMESPACE, SERVICE, Processor, handler) end def process_methodThatThrowsAnException(seqid, iprot, oprot) args = read_args(iprot, MethodThatThrowsAnException_args) result = @middleware.handle_binary('methodThatThrowsAnException', args) do |args| result = MethodThatThrowsAnException_result.new() begin @handler.methodThatThrowsAnException() rescue ::ExceptionWithAMap => xwamap result.xwamap = xwamap end result end write_result(result, oprot, 'methodThatThrowsAnException', seqid) end end # HELPER FUNCTIONS AND STRUCTURES class MethodThatThrowsAnException_args include ::Thrift::Struct, ::Thrift::Struct_Union NAME = 'methodThatThrowsAnException_args'.freeze NAMESPACE = ''.freeze FIELDS = { } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self ::Thrift.register_struct_type self end class MethodThatThrowsAnException_result include ::Thrift::Struct, ::Thrift::Struct_Union NAME = 'methodThatThrowsAnException_result'.freeze NAMESPACE = ''.freeze THRIFT_FIELD_INDEX_XWAMAP = 1 FIELDS = { THRIFT_FIELD_INDEX_XWAMAP => {type: ::Thrift::Types::STRUCT, name: 'xwamap', class: ::ExceptionWithAMap} } def struct_fields; FIELDS; end def validate end ::Thrift::Struct.generate_accessors self ::Thrift.register_struct_type self end ::Thrift.register_service_type(self) end