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