blob: d926aff37f4559052066ff5b897a7e39e27a5ea3 [file] [log] [blame]
Christopher Piro094823a2007-07-18 00:26:12 +00001%%% Copyright (c) 2007- Facebook
2%%% Distributed under the Thrift Software License
3%%%
4%%% See accompanying file LICENSE or visit the Thrift site at:
5%%% http://developers.facebook.com/thrift/
6
7-module(tProtocolException).
8
9-include("oop.hrl").
10
11-include("thrift.hrl").
12-include("protocol/tProtocolException.hrl").
13
14-behavior(oop).
15
16-export([attr/4, super/0, inspect/1]).
17
18-export([new/0, new/1, new/2]).
19
20%%%
21%%% define attributes
22%%% 'super' is required unless ?MODULE is a base class
23%%%
24
25?DEFINE_ATTR(super);
26?DEFINE_ATTR(type).
27
28%%%
29%%% behavior callbacks
30%%%
31
32%%% super() -> SuperModule = atom()
33%%% | none
34
35super() ->
36 tException.
37
38%%% inspect(This) -> string()
39
40inspect(This) ->
41 ?FORMAT_ATTR(type).
42
43%%%
44%%% class methods
45%%%
46
47new(Type, Message) ->
48 Super = (super()):new(Message),
49 #?MODULE{super=Super, type=Type}.
50
51new() ->
52 new(?tProtocolException_UNKNOWN, undefined).
53new(Type) ->
54 new(Type, undefined).
55
56%%%
57%%% instance methods
58%%%