Apache log4cxx  Version 0.12.1
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);
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:
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:
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 InterruptedException : public Exception
123 {
124  public:
126  InterruptedException(log4cxx_status_t stat);
128  InterruptedException& operator=(const InterruptedException&);
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);
138  ThreadException(const LogString& msg);
139  ThreadException(const ThreadException& src);
140  ThreadException& operator=(const ThreadException&);
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);
150  TranscoderException& operator=(const TranscoderException&);
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:
172  InstantiationException(const LogString& msg);
174  InstantiationException& operator=(const InstantiationException& msg);
175 };
176 
182 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
183 {
184  public:
185  ClassNotFoundException(const LogString& className);
187  ClassNotFoundException& operator=(const ClassNotFoundException& msg);
188  private:
189  static LogString formatMessage(const LogString& className);
190 };
191 
192 
194 {
195  public:
199 };
200 
202 {
203  public:
206  IllegalStateException& operator=(const IllegalStateException&);
207 };
208 
212 class LOG4CXX_EXPORT SocketException : public IOException
213 {
214  public:
215  SocketException(const LogString& msg);
216  SocketException(log4cxx_status_t status);
218  SocketException& operator=(const SocketException&);
219 };
220 
225 class LOG4CXX_EXPORT ConnectException : public SocketException
226 {
227  public:
228  ConnectException(log4cxx_status_t status);
230  ConnectException& operator=(const ConnectException&);
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);
250  BindException& operator=(const BindException&);
251 };
252 
259 class LOG4CXX_EXPORT InterruptedIOException : public IOException
260 {
261  public:
262  InterruptedIOException(const LogString& msg);
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
Definition: exception.h:233
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:145
Signals that an error occurred while attempting to connect a socket to a remote address and port...
Definition: exception.h:225
Signals that an I/O operation has been interrupted.
Definition: exception.h:259
Signals that an I/O operation has been interrupted.
Definition: exception.h:274
Definition: exception.h:201
Definition: exception.h:133
Thrown when an application attempts to use null in a case where an object is required.
Definition: exception.h:67
Definition: exception.h:122
Thrown when an application tries to create an instance of a class using the newInstance method in cla...
Definition: exception.h:169
Definition: exception.h:193
Definition: exception.h:111
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66
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:182
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error...
Definition: exception.h:212
Signals that an error occurred while attempting to bind a socket to a local address and port...
Definition: exception.h:245