Apache Log4cxx  Version 1.3.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 : 4275) // ::std::exception needs to have dll-interface
28 #endif
29 
30 namespace LOG4CXX_NS
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 LogString& type, log4cxx_status_t stat);
96  IOException(const IOException& src);
98  private:
99  static LogString formatMessage(log4cxx_status_t stat);
100  static LogString formatMessage(const LogString& type, log4cxx_status_t stat);
101 };
102 
103 class LOG4CXX_EXPORT MissingResourceException : public Exception
104 {
105  public:
109  private:
110  static LogString formatMessage(const LogString& key);
111 };
112 
113 class LOG4CXX_EXPORT PoolException : public Exception
114 {
115  public:
116  PoolException(log4cxx_status_t stat);
119  private:
120  static LogString formatMessage(log4cxx_status_t stat);
121 };
122 
123 
124 class LOG4CXX_EXPORT InterruptedException : public Exception
125 {
126  public:
128  InterruptedException(log4cxx_status_t stat);
131  private:
132  static LogString formatMessage(log4cxx_status_t stat);
133 };
134 
135 class LOG4CXX_EXPORT ThreadException
136  : public Exception
137 {
138  public:
139  ThreadException(log4cxx_status_t stat);
143  private:
144  static LogString formatMessage(log4cxx_status_t stat);
145 };
146 
147 class LOG4CXX_EXPORT TranscoderException : public Exception
148 {
149  public:
150  TranscoderException(log4cxx_status_t stat);
153  private:
154  static LogString formatMessage(log4cxx_status_t stat);
155 };
156 
157 class LOG4CXX_EXPORT IllegalMonitorStateException
158  : public Exception
159 {
160  public:
164 };
165 
171 class LOG4CXX_EXPORT InstantiationException : public Exception
172 {
173  public:
177 };
178 
184 class LOG4CXX_EXPORT ClassNotFoundException : public Exception
185 {
186  public:
190  private:
191  static LogString formatMessage(const LogString& className);
192 };
193 
194 
196 {
197  public:
201 };
202 
204 {
205  public:
209 };
210 
214 class LOG4CXX_EXPORT SocketException : public IOException
215 {
216  public:
218  SocketException(log4cxx_status_t status);
221 };
222 
227 class LOG4CXX_EXPORT ConnectException : public SocketException
228 {
229  public:
230  ConnectException(log4cxx_status_t status);
233 };
234 
235 class LOG4CXX_EXPORT ClosedChannelException : public SocketException
236 {
237  public:
241 };
242 
247 class LOG4CXX_EXPORT BindException : public SocketException
248 {
249  public:
250  BindException(log4cxx_status_t status);
253 };
254 
261 class LOG4CXX_EXPORT InterruptedIOException : public IOException
262 {
263  public:
267 };
268 
269 
276 class LOG4CXX_EXPORT SocketTimeoutException : public InterruptedIOException
277 {
278  public:
282 };
283 
284 
285 } // namespace helpers
286 } // namespace log4cxx
287 
288 #if defined(_MSC_VER)
289  #pragma warning (pop)
290 #endif
291 
292 #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:248
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:185
ClassNotFoundException(const LogString &className)
ClassNotFoundException(const ClassNotFoundException &msg)
ClassNotFoundException & operator=(const ClassNotFoundException &msg)
Definition: exception.h:236
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:228
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 &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:78
IllegalArgumentException & operator=(const IllegalArgumentException &)
IllegalArgumentException(const LogString &msg)
IllegalArgumentException(const IllegalArgumentException &)
IllegalMonitorStateException & operator=(const IllegalMonitorStateException &msg)
IllegalMonitorStateException(const IllegalMonitorStateException &msg)
Definition: exception.h:204
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:172
InstantiationException(const InstantiationException &msg)
InstantiationException(const LogString &msg)
InstantiationException & operator=(const InstantiationException &msg)
Definition: exception.h:125
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:262
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:196
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:114
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:215
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:277
SocketTimeoutException(const SocketTimeoutException &)
SocketTimeoutException & operator=(const SocketTimeoutException &)
Definition: exception.h:137
ThreadException(log4cxx_status_t stat)
ThreadException(const LogString &msg)
ThreadException & operator=(const ThreadException &)
ThreadException(const ThreadException &src)
Definition: exception.h:148
TranscoderException(const TranscoderException &src)
TranscoderException(log4cxx_status_t stat)
TranscoderException & operator=(const TranscoderException &)
std::basic_string< logchar > LogString
Definition: logstring.h:60