1 %%% Copyright (c) 2007- Facebook
2 %%% Distributed under the Thrift Software License
4 %%% See accompanying file LICENSE or visit the Thrift site at:
5 %%% http://developers.facebook.com/thrift/
7 -module(tApplicationException
).
9 -include("thrift.hrl").
10 -include("tApplicationException.hrl").
16 -export([attr
/4, super
/0, inspect
/1]).
18 -export([new
/0, new
/1, new
/2, read
/2, write
/2]).
22 %%% 'super' is required unless ?MODULE is a base class
28 %%% behavior callbacks
31 %%% super() -> SuperModule = atom()
37 %%% inspect(This) -> string()
47 Super
= (super()):new(Type
, Message
),
48 #?MODULE
{super
=Super
}.
50 new() -> new(?tApplicationException_UNKNOWN
, undefined
).
51 new(Type
) -> new(Type
, undefined
).
58 ?
R0(Iprot
, readStructBegin
),
59 read_while_loop(This
, Iprot
),
60 ?
R0(Iprot
, readStructEnd
),
63 read_while_loop(This
, Iprot
) ->
64 {_Fname
, Ftype
, Fid
} = ?
R0(Iprot
, readFieldBegin
),
67 Ftype
== ?tType_STOP
->
70 (Fid
== 1) and (Ftype
== ?tType_STRING
) ->
71 Message1
= ?
R0(Iprot
, readString
),
72 This1
= oop:set(This
, message
, Message1
),
73 ?
R0(Iprot
, readFieldEnd
),
74 read_while_loop(This1
, Iprot
);
78 ?
R0(Iprot
, readFieldEnd
),
79 read_while_loop(This
, Iprot
);
81 (Fid
== 2) and (Ftype
== ?tType_I32
) ->
82 Type1
= ?
R0(Iprot
, readI32
),
83 This1
= oop:set(This
, type
, Type1
),
84 ?
R0(Iprot
, readFieldEnd
),
85 read_while_loop(This1
, Iprot
);
89 ?
R0(Iprot
, readFieldEnd
),
90 read_while_loop(This
, Iprot
)
94 ?
R1(Oprot
, writeStructBegin
, "tApplicationException"),
95 Message
= oop:get(This
, message
),
96 Type
= oop:get(This
, type
),
98 if Message
/= undefined
->
99 ?
R3(Oprot
, writeFieldBegin
, "message", ?tType_STRING
, 1),
100 ?
R1(Oprot
, writeString
, Message
),
101 ?
R0(Oprot
, writeFieldEnd
);
105 if Type
/= undefined
->
106 ?
R3(Oprot
, writeFieldBegin
, "type", ?tType_I32
, 2),
107 ?
R1(Oprot
, writeI32
, Type
),
108 ?
R0(Oprot
, writeFieldEnd
);
112 ?
R0(Oprot
, writeFieldStop
),
113 ?
R0(Oprot
, writeStructEnd
),