Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
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
32namespace LOG4CXX_NS
33{
34namespace helpers
35{
39class LOG4CXX_EXPORT Exception : public ::std::exception
40{
41 public:
42 Exception(const char* msg);
43 Exception(const LogString& msg);
44 const char* what() const noexcept override;
45 static LogString makeMessage(const LogString& type, log4cxx_status_t stat);
46#if !LOG4CXX_LOGCHAR_IS_UTF8
47 static std::string makeMessage(const char* type, log4cxx_status_t stat);
48#endif
49 private:
50 std::string msg;
51}; // class Exception
52
56class LOG4CXX_EXPORT RuntimeException : public Exception
57{
58 public:
59 RuntimeException(log4cxx_status_t stat);
61 private:
62 static LogString formatMessage(log4cxx_status_t stat);
63}; // class RuntimeException
64
68class LOG4CXX_EXPORT NullPointerException : public RuntimeException
69{
70 public:
72}; // class NullPointerException
73
76class LOG4CXX_EXPORT IllegalArgumentException : public RuntimeException
77{
78 public:
80}; // class IllegalArgumentException
81
86class LOG4CXX_EXPORT IOException : public Exception
87{
88 public:
90 IOException(log4cxx_status_t stat);
92 IOException(const char* msg);
93 IOException(const LogString& type, log4cxx_status_t stat);
94#if !LOG4CXX_LOGCHAR_IS_UTF8
95 IOException(const char* msg, log4cxx_status_t stat);
96#endif
97 private:
98 static LogString formatMessage(log4cxx_status_t stat);
99};
100
101class LOG4CXX_EXPORT SubProcessFailure : public Exception
102{
103 public:
104 SubProcessFailure(const LogString& processName, int exitCode, int exitWhy);
105#if !LOG4CXX_LOGCHAR_IS_UTF8
106 SubProcessFailure(const char* processName, int exitCode, int exitWhy);
107#endif
108 static LogString makeMessage(const LogString& processName, int exitCode, int exitWhy);
109};
110
111class LOG4CXX_EXPORT MissingResourceException : public Exception
112{
113 public:
115 private:
116 static LogString formatMessage(const LogString& key);
117};
118
119class LOG4CXX_EXPORT PoolException : public Exception
120{
121 public:
122 PoolException(log4cxx_status_t stat);
123 private:
124 static LogString formatMessage(log4cxx_status_t stat);
125};
126
132class LOG4CXX_EXPORT InstantiationException : public Exception
133{
134 public:
136};
137
143class LOG4CXX_EXPORT ClassNotFoundException : public Exception
144{
145 public:
147 private:
148 static LogString formatMessage(const LogString& className);
149};
150
151
152class LOG4CXX_EXPORT NoSuchElementException : public Exception
153{
154 public:
156};
157
158class LOG4CXX_EXPORT IllegalStateException : public Exception
159{
160 public:
162};
163
167class LOG4CXX_EXPORT SocketException : public IOException
168{
169 public:
171 SocketException(log4cxx_status_t status);
172};
173
178class LOG4CXX_EXPORT ConnectException : public SocketException
179{
180 public:
182 ConnectException(log4cxx_status_t status);
183};
184
185class LOG4CXX_EXPORT ClosedChannelException : public SocketException
186{
187 public:
189};
190
195class LOG4CXX_EXPORT BindException : public SocketException
196{
197 public:
198 BindException(log4cxx_status_t status);
199};
200
207class LOG4CXX_EXPORT InterruptedIOException : public IOException
208{
209 public:
211};
212
213
221{
222 public:
224};
225
226
227} // namespace helpers
228} // namespace log4cxx
229
230#if defined(_MSC_VER)
231 #pragma warning (pop)
232#endif
233
234#endif // _LOG4CXX_HELPERS_EXCEPTION_H
BindException(log4cxx_status_t status)
ClassNotFoundException(const LogString &className)
ConnectException(const LogString &msg)
ConnectException(log4cxx_status_t status)
Exception(const LogString &msg)
static LogString makeMessage(const LogString &type, log4cxx_status_t stat)
static std::string makeMessage(const char *type, log4cxx_status_t stat)
Exception(const char *msg)
const char * what() const noexcept override
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)
IllegalArgumentException(const LogString &msg)
InstantiationException(const LogString &msg)
InterruptedIOException(const LogString &msg)
MissingResourceException(const LogString &key)
NullPointerException(const LogString &msg)
PoolException(log4cxx_status_t stat)
RuntimeException(log4cxx_status_t stat)
RuntimeException(const LogString &msg)
SocketException(log4cxx_status_t status)
SocketException(const LogString &msg)
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)
std::basic_string< logchar > LogString
Definition logstring.h:51