blob: 783b5be5b5128ffe469b12dfc90dd27dce3ea985 [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;
Mark Sleee5341192007-02-21 04:56:26 +000023
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}