#
# Autogenerated by Thrift Compiler (0.11.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

require 'thrift'
require 'debug_proto_test_types'

module Thrift
  module Test
    module ServiceForExceptionWithAMap
      class Client
        include ::Thrift::Client

        def methodThatThrowsAnException()
          send_methodThatThrowsAnException()
          recv_methodThatThrowsAnException()
        end

        def send_methodThatThrowsAnException()
          send_message('methodThatThrowsAnException', MethodThatThrowsAnException_args)
        end

        def recv_methodThatThrowsAnException()
          result = receive_message(MethodThatThrowsAnException_result)
          raise result.xwamap unless result.xwamap.nil?
          return
        end

      end

      class Processor
        include ::Thrift::Processor

        def process_methodThatThrowsAnException(seqid, iprot, oprot)
          args = read_args(iprot, MethodThatThrowsAnException_args)
          result = MethodThatThrowsAnException_result.new()
          begin
            @handler.methodThatThrowsAnException()
          rescue ::Thrift::Test::ExceptionWithAMap => xwamap
            result.xwamap = xwamap
          end
          write_result(result, oprot, 'methodThatThrowsAnException', seqid)
        end

      end

      # HELPER FUNCTIONS AND STRUCTURES

      class MethodThatThrowsAnException_args
        include ::Thrift::Struct, ::Thrift::Struct_Union

        FIELDS = {

        }

        def struct_fields; FIELDS; end

        def validate
        end

        ::Thrift::Struct.generate_accessors self
      end

      class MethodThatThrowsAnException_result
        include ::Thrift::Struct, ::Thrift::Struct_Union
        XWAMAP = 1

        FIELDS = {
          XWAMAP => {:type => ::Thrift::Types::STRUCT, :name => 'xwamap', :class => ::Thrift::Test::ExceptionWithAMap}
        }

        def struct_fields; FIELDS; end

        def validate
        end

        ::Thrift::Struct.generate_accessors self
      end

    end

  end
end
