Apache Log4cxx  Version 1.8.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 #include <string>
25 
26 #ifdef _MSC_VER
27  #pragma warning ( push )
28  #pragma warning (disable : 4275) // ::std::exception needs to have dll-interface
29  #pragma warning (disable : 4251) // ::std::basic_string needs to have dll-interface
30 #endif
31 
32 namespace LOG4CXX_NS
33 {
34 namespace helpers
35 {
39 class LOG4CXX_EXPORT Exception : public ::std::exception
40 {
41  public:
42  Exception(const char* msg);
43  Exception(const LogString& msg);
44  Exception(const Exception& src);
46  const char* what() const throw();
47  static LogString makeMessage(const LogString& type, log4cxx_status_t stat);
48 #if !LOG4CXX_LOGCHAR_IS_UTF8
49  static std::string makeMessage(const char* type, log4cxx_status_t stat);
50 #endif
51  private:
52  std::string msg;
53 }; // class Exception
54 
58 class LOG4CXX_EXPORT RuntimeException : public Exception
59 {
60  public:
61  RuntimeException(log4cxx_status_t stat);
65  private:
66  static LogString formatMessage(log4cxx_status_t stat);
67 }; // class RuntimeException
68 
72 class LOG4CXX_EXPORT NullPointerException : public RuntimeException
73 {
74  public:
78 }; // class NullPointerException
79 
82 class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
83 {
84  public:
88 }; // class IllegalArgumentException
89 
94 class LOG4CXX_EXPORT IOException : public Exception
95 {
96  public:
98  IOException(log4cxx_status_t stat);
99  IOException(const LogString& msg);
100  IOException(const char* msg);
101  IOException(const LogString& type, log4cxx_status_t stat);
102 #if !LOG4CXX_LOGCHAR_IS_UTF8
103  IOException(const char* msg, log4cxx_status_t stat);
104 #endif
107  private:
108  static LogString formatMessage(log4cxx_status_t stat);
109 };
110 
111 class LOG4CXX_EXPORT SubProcessFailure : public Exception
112 {
113  public:
114  SubProcessFailure(const LogString& processName, int exitCode, int exitWhy);
115 #if !LOG4CXX_LOGCHAR_IS_UTF8
116  SubProcessFailure(const char* processName, int exitCode, int exitWhy);
117 #endif
120 
121  static LogString makeMessage(const LogString& processName, int exitCode, int exitWhy);
122 };
123 
124 class LOG4CXX_EXPORT MissingResourceException : public Exception
125 {
126  public:
130  private:
131  static LogString formatMessage(const LogString& key);
132 };
133 
134 class LOG4CXX_EXPORT PoolException : public Exception
135 {
136  public:
137  PoolException(log4cxx_status_t stat);
140  private:
141  static LogString formatMessage(log4cxx_status_t stat);
142 };
143 
144 
145 class LOG4CXX_EXPORT InterruptedException : public Exception
146 {
147  public:
149  InterruptedException(log4cxx_status_t stat);
152  private:
153  static LogString formatMessage(log4cxx_status_t stat);
154 };
155 
156 class LOG4CXX_EXPORT ThreadException
157  : public Exception
158 {
159  public:
160  ThreadException(log4cxx_status_t stat);
164  private:
165  static LogString formatMessage(log4cxx_status_t stat);
166 };
167 
168 class LOG4CXX_EXPORT TranscoderException : public Exception
169 {
170  public:
171  TranscoderException(log4cxx_status_t stat);
174  private:
175  static LogString formatMessage(log4cxx_status_t stat);
176 };
177 
178 class LOG4CXX_EXPORT IllegalMonitorStateException
179  : public Exception
180 {
181  public:
185 };
186 
192 class LOG4CXX_EXPORT InstantiationException : public Exception
193 {
194  public:
198 };
199 
205 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
206 {
207  public:
211  private:
212  static LogString formatMessage(const LogString& className);
213 };
214 
215 
216 class LOG4CXX_EXPORT NoSuchElementException : public Exception
217 {
218  public:
222 };
223 
224 class LOG4CXX_EXPORT IllegalStateException : public Exception
225 {
226  public:
230 };
231 
235 class LOG4CXX_EXPORT SocketException : public IOException
236 {
237  public:
239  SocketException(log4cxx_status_t status);
242 };
243 
248 class LOG4CXX_EXPORT ConnectException : public SocketException
249 {
250  public:
252  ConnectException(log4cxx_status_t status);
255 };
256 
257 class LOG4CXX_EXPORT ClosedChannelException : public SocketException
258 {
259  public:
263 };
264 
269 class LOG4CXX_EXPORT BindException : public SocketException
270 {
271  public:
272  BindException(log4cxx_status_t status);
275 };
276 
283 class LOG4CXX_EXPORT InterruptedIOException : public IOException
284 {
285  public:
289 };
290 
291 
298 class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
299 {
300  public:
304 };
305 
306 
307 } // namespace helpers
308 } // namespace log4cxx
309 
310 #if defined(_MSC_VER)
311  #pragma warning (pop)
312 #endif
313 
314 #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:270
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:206
ClassNotFoundException(const LogString &className)
ClassNotFoundException(const ClassNotFoundException &msg)
ClassNotFoundException & operator=(const ClassNotFoundException &msg)
Definition: exception.h:258
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:249
ConnectException & operator=(const ConnectException &)
ConnectException(const LogString &msg)
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:40
Exception(const LogString &msg)
Exception & operator=(const Exception &src)
static std::string makeMessage(const char *type, log4cxx_status_t stat)
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:95
IOException & operator=(const IOException &)
IOException(const char *msg)
IOException(log4cxx_status_t stat)
IOException(const char *msg, log4cxx_status_t stat)
IOException(const LogString &type, 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:83
IllegalArgumentException & operator=(const IllegalArgumentException &)
IllegalArgumentException(const LogString &msg)
IllegalArgumentException(const IllegalArgumentException &)
IllegalMonitorStateException & operator=(const IllegalMonitorStateException &msg)
IllegalMonitorStateException(const IllegalMonitorStateException &msg)
Definition: exception.h:225
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:193
InstantiationException(const InstantiationException &msg)
InstantiationException(const LogString &msg)
InstantiationException & operator=(const InstantiationException &msg)
Definition: exception.h:146
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:284
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:217
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:73
NullPointerException(const LogString &msg)
NullPointerException(const NullPointerException &msg)
NullPointerException & operator=(const NullPointerException &src)
Definition: exception.h:135
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:59
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:236
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:299
SocketTimeoutException(const SocketTimeoutException &)
SocketTimeoutException & operator=(const SocketTimeoutException &)
Definition: exception.h:112
SubProcessFailure & operator=(const SubProcessFailure &)
static LogString makeMessage(const LogString &processName, int exitCode, int exitWhy)
SubProcessFailure(const LogString &processName, int exitCode, int exitWhy)
SubProcessFailure(const char *processName, int exitCode, int exitWhy)
SubProcessFailure(const SubProcessFailure &src)
Definition: exception.h:158
ThreadException(log4cxx_status_t stat)
ThreadException(const LogString &msg)
ThreadException & operator=(const ThreadException &)
ThreadException(const ThreadException &src)
Definition: exception.h:169
TranscoderException(const TranscoderException &src)
TranscoderException(log4cxx_status_t stat)
TranscoderException & operator=(const TranscoderException &)
std::basic_string< logchar > LogString
Definition: logstring.h:60