Exception: Thrift::ApplicationException

Inherits:
Exception
  • Object
show all
Defined in:
lib/thrift/exceptions.rb

Constant Summary collapse

UNKNOWN =
0
UNKNOWN_METHOD =
1
INVALID_MESSAGE_TYPE =
2
WRONG_METHOD_NAME =
3
BAD_SEQUENCE_ID =
4
MISSING_RESULT =
5
INTERNAL_ERROR =
6
PROTOCOL_ERROR =
7
INVALID_TRANSFORM =
8
INVALID_PROTOCOL =
9
UNSUPPORTED_CLIENT_TYPE =
10

Instance Attribute Summary collapse

Attributes inherited from Exception

#message

Instance Method Summary collapse

Constructor Details

#initialize(type = UNKNOWN, message = nil) ⇒ ApplicationException

Returns a new instance of ApplicationException.



46
47
48
49
# File 'lib/thrift/exceptions.rb', line 46

def initialize(type=UNKNOWN, message=nil)
  super(message)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



44
45
46
# File 'lib/thrift/exceptions.rb', line 44

def type
  @type
end

Instance Method Details

#read(iprot) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/thrift/exceptions.rb', line 51

def read(iprot)
  iprot.read_struct_begin
  while true
    fname, ftype, fid = iprot.read_field_begin
    if ftype == Types::STOP
      break
    end
    if fid == 1 and ftype == Types::STRING
      @message = iprot.read_string
    elsif fid == 2 and ftype == Types::I32
      @type = iprot.read_i32
    else
      iprot.skip(ftype)
    end
    iprot.read_field_end
  end
  iprot.read_struct_end
end

#write(oprot) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/thrift/exceptions.rb', line 70

def write(oprot)
  oprot.write_struct_begin('Thrift::ApplicationException')
  unless @message.nil?
    oprot.write_field_begin('message', Types::STRING, 1)
    oprot.write_string(@message)
    oprot.write_field_end
  end
  unless @type.nil?
    oprot.write_field_begin('type', Types::I32, 2)
    oprot.write_i32(@type)
    oprot.write_field_end
  end
  oprot.write_field_stop
  oprot.write_struct_end
end