summaryrefslogtreecommitdiff
path: root/boost/log/exceptions.hpp
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/log/exceptions.hpp
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/log/exceptions.hpp')
-rw-r--r--boost/log/exceptions.hpp387
1 files changed, 387 insertions, 0 deletions
diff --git a/boost/log/exceptions.hpp b/boost/log/exceptions.hpp
new file mode 100644
index 0000000000..8171d0a3f0
--- /dev/null
+++ b/boost/log/exceptions.hpp
@@ -0,0 +1,387 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2014.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file
+ * \author Andrey Semashev
+ * \date 31.10.2009
+ *
+ * The header contains exception classes declarations.
+ */
+
+#ifndef BOOST_LOG_EXCEPTIONS_HPP_INCLUDED_
+#define BOOST_LOG_EXCEPTIONS_HPP_INCLUDED_
+
+#include <cstddef>
+#include <string>
+#include <stdexcept>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/log/detail/config.hpp>
+#include <boost/log/attributes/attribute_name.hpp>
+#include <boost/log/utility/type_info_wrapper.hpp>
+#include <boost/log/detail/header.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+namespace boost {
+
+// Forward-declaration of an exception base class from Boost.Exception
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+
+class exception;
+
+# pragma GCC visibility pop
+# else
+
+class exception;
+
+# endif
+#else
+
+class BOOST_SYMBOL_VISIBLE exception;
+
+#endif
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+//! Attaches attribute name exception information
+BOOST_LOG_API void attach_attribute_name_info(exception& e, attribute_name const& name);
+
+} // namespace aux
+
+/*!
+ * \brief Base class for runtime exceptions from the logging library
+ *
+ * Exceptions derived from this class indicate a problem that may not directly
+ * be caused by the user's code that interacts with the library, such as
+ * errors caused by input data.
+ */
+class BOOST_LOG_API runtime_error :
+ public std::runtime_error
+{
+protected:
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit runtime_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~runtime_error() throw();
+};
+
+/*!
+ * \brief Exception class that is used to indicate errors of missing values
+ */
+class BOOST_LOG_API missing_value :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ missing_value();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit missing_value(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~missing_value() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, attribute_name const& name);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate errors of incorrect type of an object
+ */
+class BOOST_LOG_API invalid_type :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ invalid_type();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit invalid_type(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~invalid_type() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, attribute_name const& name);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, type_info_wrapper const& type);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, attribute_name const& name, type_info_wrapper const& type);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate errors of incorrect value of an object
+ */
+class BOOST_LOG_API invalid_value :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ invalid_value();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit invalid_value(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~invalid_value() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate parsing errors
+ */
+class BOOST_LOG_API parse_error :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ parse_error();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit parse_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~parse_error() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, std::size_t content_line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr, attribute_name const& name);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate conversion errors
+ */
+class BOOST_LOG_API conversion_error :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ conversion_error();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit conversion_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~conversion_error() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate underlying OS API errors
+ */
+class BOOST_LOG_API system_error :
+ public runtime_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ system_error();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit system_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~system_error() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Base class for logic exceptions from the logging library
+ *
+ * Exceptions derived from this class usually indicate errors on the user's side, such as
+ * incorrect library usage.
+ */
+class BOOST_LOG_API logic_error :
+ public std::logic_error
+{
+protected:
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit logic_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~logic_error() throw();
+};
+
+/*!
+ * \brief Exception class that is used to indicate ODR violation
+ */
+class BOOST_LOG_API odr_violation :
+ public logic_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ odr_violation();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit odr_violation(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~odr_violation() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate invalid call sequence
+ */
+class BOOST_LOG_API unexpected_call :
+ public logic_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ unexpected_call();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit unexpected_call(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~unexpected_call() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate invalid library setup
+ */
+class BOOST_LOG_API setup_error :
+ public logic_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ setup_error();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit setup_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~setup_error() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+/*!
+ * \brief Exception class that is used to indicate library limitation
+ */
+class BOOST_LOG_API limitation_error :
+ public logic_error
+{
+public:
+ /*!
+ * Default constructor. Creates an exception with the default error message.
+ */
+ limitation_error();
+ /*!
+ * Initializing constructor. Creates an exception with the specified error message.
+ */
+ explicit limitation_error(std::string const& descr);
+ /*!
+ * Destructor
+ */
+ ~limitation_error() throw();
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line);
+ static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, std::string const& descr);
+#endif
+};
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#ifndef BOOST_LOG_DOXYGEN_PASS
+
+#define BOOST_LOG_THROW(ex)\
+ ex::throw_(__FILE__, static_cast< std::size_t >(__LINE__))
+
+#define BOOST_LOG_THROW_DESCR(ex, descr)\
+ ex::throw_(__FILE__, static_cast< std::size_t >(__LINE__), descr)
+
+#define BOOST_LOG_THROW_DESCR_PARAMS(ex, descr, params)\
+ ex::throw_(__FILE__, static_cast< std::size_t >(__LINE__), descr, BOOST_PP_SEQ_ENUM(params))
+
+#endif // BOOST_LOG_DOXYGEN_PASS
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_EXCEPTIONS_HPP_INCLUDED_