Apache log4cxx  Version 0.11.0
exception.h
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);
43  Exception& operator=(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);
57  RuntimeException(const LogString& msg);
59  RuntimeException& operator=(const RuntimeException& src);
60  private:
61  static LogString formatMessage(log4cxx_status_t stat);
62 }; // class RuntimeException
63 
67 class LOG4CXX_EXPORT NullPointerException : public RuntimeException
68 {
69  public:
70  NullPointerException(const LogString& msg);
72  NullPointerException& operator=(const NullPointerException& src);
73 }; // class NullPointerException
74 
77 class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
78 {
79  public:
80  IllegalArgumentException(const LogString& msg);
83 }; // class IllegalArgumentException
84 
89 class LOG4CXX_EXPORT IOException : public Exception
90 {
91  public:
92  IOException();
93  IOException(log4cxx_status_t stat);
94  IOException(const LogString& msg);
95  IOException(const IOException& src);
96  IOException& operator=(const IOException&);
97  private:
98  static LogString formatMessage(log4cxx_status_t stat);
99 };
100 
101 class LOG4CXX_EXPORT MissingResourceException : public Exception
102 {
103  public:
104  MissingResourceException(const LogString& key);
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);
115  PoolException(const PoolException& src);
116  PoolException& operator=(const PoolException&);
117  private:
118  static LogString formatMessage(log4cxx_status_t stat);
119 };
120 
121 
122 class LOG4CXX_EXPORT MutexException : public Exception
123 {
124  public:
125  MutexException(log4cxx_status_t stat);
126  MutexException(const MutexException& src);
127  MutexException& operator=(const MutexException&);
128  private:
129  static LogString formatMessage(log4cxx_status_t stat);
130 };
131 
132 class LOG4CXX_EXPORT InterruptedException : public Exception
133 {
134  public:
136  InterruptedException(log4cxx_status_t stat);
138  InterruptedException& operator=(const InterruptedException&);
139  private:
140  static LogString formatMessage(log4cxx_status_t stat);
141 };
142 
143 class LOG4CXX_EXPORT ThreadException
144  : public Exception
145 {
146  public:
147  ThreadException(log4cxx_status_t stat);
148  ThreadException(const LogString& msg);
149  ThreadException(const ThreadException& src);
150  ThreadException& operator=(const ThreadException&);
151  private:
152  static LogString formatMessage(log4cxx_status_t stat);
153 };
154 
155 class LOG4CXX_EXPORT TranscoderException : public Exception
156 {
157  public:
158  TranscoderException(log4cxx_status_t stat);
160  TranscoderException& operator=(const TranscoderException&);
161  private:
162  static LogString formatMessage(log4cxx_status_t stat);
163 };
164 
165 class LOG4CXX_EXPORT IllegalMonitorStateException
166  : public Exception
167 {
168  public:
169  IllegalMonitorStateException(const LogString& msg);
172 };
173 
179 class LOG4CXX_EXPORT InstantiationException : public Exception
180 {
181  public:
182  InstantiationException(const LogString& msg);
184  InstantiationException& operator=(const InstantiationException& msg);
185 };
186 
192 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
193 {
194  public:
195  ClassNotFoundException(const LogString& className);
197  ClassNotFoundException& operator=(const ClassNotFoundException& msg);
198  private:
199  static LogString formatMessage(const LogString& className);
200 };
201 
202 
204 {
205  public:
209 };
210 
212 {
213  public:
216  IllegalStateException& operator=(const IllegalStateException&);
217 };
218 
222 class LOG4CXX_EXPORT SocketException : public IOException
223 {
224  public:
225  SocketException(const LogString& msg);
226  SocketException(log4cxx_status_t status);
228  SocketException& operator=(const SocketException&);
229 };
230 
235 class LOG4CXX_EXPORT ConnectException : public SocketException
236 {
237  public:
238  ConnectException(log4cxx_status_t status);
240  ConnectException& operator=(const ConnectException&);
241 };
242 
243 class LOG4CXX_EXPORT ClosedChannelException : public SocketException
244 {
245  public:
249 };
250 
255 class LOG4CXX_EXPORT BindException : public SocketException
256 {
257  public:
258  BindException(log4cxx_status_t status);
260  BindException& operator=(const BindException&);
261 };
262 
269 class LOG4CXX_EXPORT InterruptedIOException : public IOException
270 {
271  public:
272  InterruptedIOException(const LogString& msg);
275 };
276 
277 
284 class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
285 {
286  public:
290 };
291 
292 
293 } // namespace helpers
294 } // namespace log4cxx
295 
296 #if defined(_MSC_VER)
297  #pragma warning (pop)
298 #endif
299 
300 #endif // _LOG4CXX_HELPERS_EXCEPTION_H
Definition: exception.h:243
Definition: exception.h:122
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition: exception.h:77
Signals that an I/O exception of some sort has occurred.
Definition: exception.h:89
Definition: exception.h:155
Signals that an error occurred while attempting to connect a socket to a remote address and port...
Definition: exception.h:235
Signals that an I/O operation has been interrupted.
Definition: exception.h:269
Signals that an I/O operation has been interrupted.
Definition: exception.h:284
Definition: exception.h:211
Definition: exception.h:143
Thrown when an application attempts to use null in a case where an object is required.
Definition: exception.h:67
Definition: exception.h:132
Thrown when an application tries to create an instance of a class using the newInstance method in cla...
Definition: exception.h:179
Definition: exception.h:203
Definition: exception.h:111
Definition: appender.h:33
RuntimeException is the parent class of those exceptions that can be thrown during the normal operati...
Definition: exception.h:53
The class Exception and its subclasses indicate conditions that a reasonable application might want t...
Definition: exception.h:37
Thrown when an application tries to load in a class through its string name but no definition for the...
Definition: exception.h:192
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error...
Definition: exception.h:222
Signals that an error occurred while attempting to bind a socket to a local address and port...
Definition: exception.h:255