MCPcopy Create free account
hub / github.com/apache/thrift / TApplicationException

Class TApplicationException

lib/cpp/src/thrift/TApplicationException.h:32–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32class TApplicationException : public TException {
33public:
34 /**
35 * Error codes for the various types of exceptions.
36 */
37 enum TApplicationExceptionType {
38 UNKNOWN = 0,
39 UNKNOWN_METHOD = 1,
40 INVALID_MESSAGE_TYPE = 2,
41 WRONG_METHOD_NAME = 3,
42 BAD_SEQUENCE_ID = 4,
43 MISSING_RESULT = 5,
44 INTERNAL_ERROR = 6,
45 PROTOCOL_ERROR = 7,
46 INVALID_TRANSFORM = 8,
47 INVALID_PROTOCOL = 9,
48 UNSUPPORTED_CLIENT_TYPE = 10
49 };
50
51 TApplicationException() : TException(), type_(UNKNOWN) {}
52
53 TApplicationException(TApplicationExceptionType type) : TException(), type_(type) {}
54
55 TApplicationException(const std::string& message) : TException(message), type_(UNKNOWN) {}
56
57 TApplicationException(TApplicationExceptionType type, const std::string& message)
58 : TException(message), type_(type) {}
59
60 ~TApplicationException() noexcept override = default;
61
62 /**
63 * Returns an error code that provides information about the type of error
64 * that has occurred.
65 *
66 * @return Error code
67 */
68 TApplicationExceptionType getType() const { return type_; }
69
70 const char* what() const noexcept override {
71 if (message_.empty()) {
72 switch (type_) {
73 case UNKNOWN:
74 return "TApplicationException: Unknown application exception";
75 case UNKNOWN_METHOD:
76 return "TApplicationException: Unknown method";
77 case INVALID_MESSAGE_TYPE:
78 return "TApplicationException: Invalid message type";
79 case WRONG_METHOD_NAME:
80 return "TApplicationException: Wrong method name";
81 case BAD_SEQUENCE_ID:
82 return "TApplicationException: Bad sequence identifier";
83 case MISSING_RESULT:
84 return "TApplicationException: Missing result";
85 case INTERNAL_ERROR:
86 return "TApplicationException: Internal error";
87 case PROTOCOL_ERROR:
88 return "TApplicationException: Protocol error";
89 case INVALID_TRANSFORM:

Callers 5

resetProtocolMethod · 0.50
untransformMethod · 0.50
readVarint32Method · 0.50
throwBadSeqId_Method · 0.50
generateSeqIdMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected