Apache log4cxx  Version 0.13.0
exception.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_HELPERS_EXCEPTION_H
19 #define _LOG4CXX_HELPERS_EXCEPTION_H
20 
21 #include <exception>
22 #include <log4cxx/log4cxx.h>
23 #include <log4cxx/logstring.h>
24 
25 #ifdef _MSC_VER
26  #pragma warning ( push )
27  #pragma warning (disable : 4251 4275) // ::std::exception needs to have dll-interface
28 #endif
29 
30 namespace log4cxx
31 {
32 namespace helpers
33 {
37 class LOG4CXX_EXPORT Exception : public ::std::exception
38 {
39  public:
40  Exception(const char* msg);
41  Exception(const LogString& msg);
42  Exception(const Exception& src);
44  const char* what() const throw();
45  private:
46  enum { MSG_SIZE = 128 };
47  char msg[MSG_SIZE + 1];
48 }; // class Exception
49 
53 class LOG4CXX_EXPORT RuntimeException : public Exception
54 {
55  public:
56  RuntimeException(log4cxx_status_t stat);
60  private:
61  static LogString formatMessage(log4cxx_status_t stat);
62 }; // class RuntimeException
63 
67 class LOG4CXX_EXPORT NullPointerException : public RuntimeException
68 {
69  public:
73 }; // class NullPointerException
74 
77 class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
78 {
79  public:
83 }; // class IllegalArgumentException
84 
89 class LOG4CXX_EXPORT IOException : public Exception
90 {
91  public:
93  IOException(log4cxx_status_t stat);
94  IOException(const LogString& msg);
95  IOException(const IOException& src);
97  private:
98  static LogString formatMessage(log4cxx_status_t stat);
99 };
100 
101 class LOG4CXX_EXPORT MissingResourceException : public Exception
102 {
103  public:
107  private:
108  static LogString formatMessage(const LogString& key);
109 };
110 
111 class LOG4CXX_EXPORT PoolException : public Exception
112 {
113  public:
114  PoolException(log4cxx_status_t stat);
117  private:
118  static LogString formatMessage(log4cxx_status_t stat);
119 };
120 
121 
122 class LOG4CXX_EXPORT InterruptedException : public Exception
123 {
124  public:
126  InterruptedException(log4cxx_status_t stat);
129  private:
130  static LogString formatMessage(log4cxx_status_t stat);
131 };
132 
133 class LOG4CXX_EXPORT ThreadException
134  : public Exception
135 {
136  public:
137  ThreadException(log4cxx_status_t stat);
141  private:
142  static LogString formatMessage(log4cxx_status_t stat);
143 };
144 
145 class LOG4CXX_EXPORT TranscoderException : public Exception
146 {
147  public:
148  TranscoderException(log4cxx_status_t stat);
151  private:
152  static LogString formatMessage(log4cxx_status_t stat);
153 };
154 
155 class LOG4CXX_EXPORT IllegalMonitorStateException
156  : public Exception
157 {
158  public:
162 };
163 
169 class LOG4CXX_EXPORT InstantiationException : public Exception
170 {
171  public:
175 };
176 
182 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
183 {
184  public:
188  private:
189  static LogString formatMessage(const LogString& className);
190 };
191 
192 
194 {
195  public:
199 };
200 
202 {
203  public:
207 };
208 
212 class LOG4CXX_EXPORT SocketException : public IOException
213 {
214  public:
216  SocketException(log4cxx_status_t status);
219 };
220 
225 class LOG4CXX_EXPORT ConnectException : public SocketException
226 {
227  public:
228  ConnectException(log4cxx_status_t status);
231 };
232 
233 class LOG4CXX_EXPORT ClosedChannelException : public SocketException
234 {
235  public:
239 };
240 
245 class LOG4CXX_EXPORT BindException : public SocketException
246 {
247  public:
248  BindException(log4cxx_status_t status);
251 };
252 
259 class LOG4CXX_EXPORT InterruptedIOException : public IOException
260 {
261  public:
265 };
266 
267 
274 class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
275 {
276  public:
280 };
281 
282 
283 } // namespace helpers
284 } // namespace log4cxx
285 
286 #if defined(_MSC_VER)
287  #pragma warning (pop)
288 #endif
289 
290 #endif // _LOG4CXX_HELPERS_EXCEPTION_H
Signals that an error occurred while attempting to bind a socket to a local address and port.
Definition: exception.h:246
BindException(const BindException &)
BindException & operator=(const BindException &)
BindException(log4cxx_status_t status)
Thrown when an application tries to load in a class through its string name but no definition for the...
Definition: exception.h:183
ClassNotFoundException(const LogString &className)
ClassNotFoundException(const ClassNotFoundException &msg)
ClassNotFoundException & operator=(const ClassNotFoundException &msg)
Definition: exception.h:234
ClosedChannelException(const ClosedChannelException &src)
ClosedChannelException & operator=(const ClosedChannelException &)
Signals that an error occurred while attempting to connect a socket to a remote address and port.
Definition: exception.h:226
ConnectException & operator=(const ConnectException &)
ConnectException(const ConnectException &src)
ConnectException(log4cxx_status_t status)
The class Exception and its subclasses indicate conditions that a reasonable application might want t...
Definition: exception.h:38
Exception(const LogString &msg)
Exception & operator=(const Exception &src)
const char * what() const
Exception(const char *msg)
Exception(const Exception &src)
Signals that an I/O exception of some sort has occurred.
Definition: exception.h:90
IOException & operator=(const IOException &)
IOException(log4cxx_status_t stat)
IOException(const LogString &msg)
IOException(const IOException &src)
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition: exception.h:78
IllegalArgumentException & operator=(const IllegalArgumentException &)
IllegalArgumentException(const LogString &msg)
IllegalArgumentException(const IllegalArgumentException &)
IllegalMonitorStateException & operator=(const IllegalMonitorStateException &msg)
IllegalMonitorStateException(const IllegalMonitorStateException &msg)
Definition: exception.h:202
IllegalStateException & operator=(const IllegalStateException &)
IllegalStateException(const IllegalStateException &)
Thrown when an application tries to create an instance of a class using the newInstance method in cla...
Definition: exception.h:170
InstantiationException(const InstantiationException &msg)
InstantiationException(const LogString &msg)
InstantiationException & operator=(const InstantiationException &msg)
Definition: exception.h:123
InterruptedException(const InterruptedException &src)
InterruptedException(log4cxx_status_t stat)
InterruptedException & operator=(const InterruptedException &)
Signals that an I/O operation has been interrupted.
Definition: exception.h:260
InterruptedIOException(const InterruptedIOException &)
InterruptedIOException & operator=(const InterruptedIOException &)
InterruptedIOException(const LogString &msg)
MissingResourceException(const LogString &key)
MissingResourceException & operator=(const MissingResourceException &)
MissingResourceException(const MissingResourceException &src)
Definition: exception.h:194
NoSuchElementException(const NoSuchElementException &)
NoSuchElementException & operator=(const NoSuchElementException &)
Thrown when an application attempts to use null in a case where an object is required.
Definition: exception.h:68
NullPointerException(const LogString &msg)
NullPointerException(const NullPointerException &msg)
NullPointerException & operator=(const NullPointerException &src)
Definition: exception.h:112
PoolException(const PoolException &src)
PoolException(log4cxx_status_t stat)
PoolException & operator=(const PoolException &)
RuntimeException is the parent class of those exceptions that can be thrown during the normal operati...
Definition: exception.h:54
RuntimeException(const RuntimeException &msg)
RuntimeException & operator=(const RuntimeException &src)
RuntimeException(log4cxx_status_t stat)
RuntimeException(const LogString &msg)
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
Definition: exception.h:213
SocketException & operator=(const SocketException &)
SocketException(const SocketException &)
SocketException(log4cxx_status_t status)
SocketException(const LogString &msg)
Signals that an I/O operation has been interrupted.
Definition: exception.h:275
SocketTimeoutException(const SocketTimeoutException &)
SocketTimeoutException & operator=(const SocketTimeoutException &)
Definition: exception.h:135
ThreadException(log4cxx_status_t stat)
ThreadException(const LogString &msg)
ThreadException & operator=(const ThreadException &)
ThreadException(const ThreadException &src)
Definition: exception.h:146
TranscoderException(const TranscoderException &src)
TranscoderException(log4cxx_status_t stat)
TranscoderException & operator=(const TranscoderException &)
Definition: appender.h:33
std::basic_string< logchar > LogString
Definition: logstring.h:66