blob: 9373de3c8394d07a8297ccee36e343b76f3180e6 [file] [log] [blame]
Mark Slee7eb0d632007-03-01 00:00:27 +00001// 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 Sleee5341192007-02-21 04:56:26 +00007package com.facebook.thrift.protocol;
8
9import com.facebook.thrift.TException;
10
11/**
12 * Protocol exceptions.
13 *
14 * @author Mark Slee <mcslee@facebook.com>
15 */
16public 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 Slee808454e2007-06-20 21:51:57 +000022 public static final int BAD_VERSION = 4;
David Reiss80f63982008-03-07 20:12:13 +000023 public static final int NOT_IMPLEMENTED = 5;
Mark Sleee5341192007-02-21 04:56:26 +000024
25 protected int type_ = UNKNOWN;
26
27 public TProtocolException() {
28 super();
29 }
30
31 public TProtocolException(int type) {
32 super();
33 type_ = type;
34 }
35
36 public TProtocolException(int type, String message) {
37 super(message);
38 type_ = type;
39 }
40
41 public TProtocolException(String message) {
42 super(message);
43 }
44
45 public TProtocolException(int type, Throwable cause) {
46 super(cause);
47 type_ = type;
48 }
49
50 public TProtocolException(Throwable cause) {
51 super(cause);
52 }
53
54 public TProtocolException(String message, Throwable cause) {
55 super(message, cause);
56 }
57
58 public TProtocolException(int type, String message, Throwable cause) {
59 super(message, cause);
60 type_ = type;
61 }
62
63 public int getType() {
64 return type_;
65 }
66
67}