Mark Slee | e534119 | 2007-02-21 04:56:26 +0000 | [diff] [blame^] | 1 | package com.facebook.thrift.protocol; |
| 2 | |
| 3 | import com.facebook.thrift.TException; |
| 4 | |
| 5 | /** |
| 6 | * Protocol exceptions. |
| 7 | * |
| 8 | * @author Mark Slee <mcslee@facebook.com> |
| 9 | */ |
| 10 | public class TProtocolException extends TException { |
| 11 | |
| 12 | public static final int UNKNOWN = 0; |
| 13 | public static final int INVALID_DATA = 1; |
| 14 | public static final int NEGATIVE_SIZE = 2; |
| 15 | public static final int SIZE_LIMIT = 3; |
| 16 | |
| 17 | protected int type_ = UNKNOWN; |
| 18 | |
| 19 | public TProtocolException() { |
| 20 | super(); |
| 21 | } |
| 22 | |
| 23 | public TProtocolException(int type) { |
| 24 | super(); |
| 25 | type_ = type; |
| 26 | } |
| 27 | |
| 28 | public TProtocolException(int type, String message) { |
| 29 | super(message); |
| 30 | type_ = type; |
| 31 | } |
| 32 | |
| 33 | public TProtocolException(String message) { |
| 34 | super(message); |
| 35 | } |
| 36 | |
| 37 | public TProtocolException(int type, Throwable cause) { |
| 38 | super(cause); |
| 39 | type_ = type; |
| 40 | } |
| 41 | |
| 42 | public TProtocolException(Throwable cause) { |
| 43 | super(cause); |
| 44 | } |
| 45 | |
| 46 | public TProtocolException(String message, Throwable cause) { |
| 47 | super(message, cause); |
| 48 | } |
| 49 | |
| 50 | public TProtocolException(int type, String message, Throwable cause) { |
| 51 | super(message, cause); |
| 52 | type_ = type; |
| 53 | } |
| 54 | |
| 55 | public int getType() { |
| 56 | return type_; |
| 57 | } |
| 58 | |
| 59 | } |