Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
Exception.h
Go to the documentation of this file.
1 #ifndef _Exception_
2 #define _Exception_
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
26 #include "qpid/framing/constants.h"
27 #include "qpid/framing/enum.h"
28 #include "qpid/sys/StrError.h"
30 #include <string>
31 #include <errno.h>
32 
33 namespace qpid
34 {
35 
39 class QPID_COMMON_CLASS_EXTERN Exception : public std::exception
40 {
41  public:
42  QPID_COMMON_EXTERN explicit Exception(const std::string& message=std::string()) throw();
43  QPID_COMMON_EXTERN virtual ~Exception() throw();
44  QPID_COMMON_EXTERN virtual const char* what() const throw(); // prefix: message
45  QPID_COMMON_EXTERN virtual std::string getMessage() const; // Unprefixed message
46  QPID_COMMON_EXTERN virtual std::string getPrefix() const; // Prefix
47 
48  private:
49  std::string message;
50  mutable std::string whatStr;
51 };
52 
55  ErrnoException(const std::string& msg, int err) : Exception(msg+": "+qpid::sys::strError(err)) {}
56  ErrnoException(const std::string& msg) : Exception(msg+": "+qpid::sys::strError(errno)) {}
57 };
58 
61  SessionException(framing::execution::ErrorCode code_, const std::string& message)
62  : Exception(message), code(code_) {}
63 };
64 
67  ChannelException(framing::session::DetachCode _code, const std::string& message)
68  : Exception(message), code(_code) {}
69 };
70 
73  ConnectionException(framing::connection::CloseCode _code, const std::string& message)
74  : Exception(message), code(_code) {}
75 };
76 
78  QPID_COMMON_EXTERN ClosedException(const std::string& msg=std::string());
79  QPID_COMMON_EXTERN std::string getPrefix() const;
80 };
81 
85 struct TransportFailure : public Exception {
86  TransportFailure(const std::string& msg=std::string()) : Exception(msg) {}
87 };
88 
89 } // namespace qpid
90 
91 #endif

Qpid C++ API Reference
Generated on Tue Jul 2 2013 for Qpid C++ Client API by doxygen 1.8.1.1