multiple_exceptions.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // multiple_exceptions.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP
  11. #define BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <exception>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. #if defined(BOOST_ASIO_HAS_STD_EXCEPTION_PTR) \
  21. || defined(GENERATING_DOCUMENTATION)
  22. /// Exception thrown when there are multiple pending exceptions to rethrow.
  23. class multiple_exceptions
  24. : public std::exception
  25. {
  26. public:
  27. /// Constructor.
  28. BOOST_ASIO_DECL multiple_exceptions(
  29. std::exception_ptr first) BOOST_ASIO_NOEXCEPT;
  30. /// Obtain message associated with exception.
  31. BOOST_ASIO_DECL virtual const char* what() const
  32. BOOST_ASIO_NOEXCEPT_OR_NOTHROW;
  33. /// Obtain a pointer to the first exception.
  34. BOOST_ASIO_DECL std::exception_ptr first_exception() const;
  35. private:
  36. std::exception_ptr first_;
  37. };
  38. #endif // defined(BOOST_ASIO_HAS_STD_EXCEPTION_PTR)
  39. // || defined(GENERATING_DOCUMENTATION)
  40. } // namespace asio
  41. } // namespace boost
  42. #include <boost/asio/detail/pop_options.hpp>
  43. #if defined(BOOST_ASIO_HEADER_ONLY)
  44. # include <boost/asio/impl/multiple_exceptions.ipp>
  45. #endif // defined(BOOST_ASIO_HEADER_ONLY)
  46. #endif // BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP