multiple_exceptions.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // multiple_exceptions.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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. /// Exception thrown when there are multiple pending exceptions to rethrow.
  21. class multiple_exceptions
  22. : public std::exception
  23. {
  24. public:
  25. /// Constructor.
  26. BOOST_ASIO_DECL multiple_exceptions(
  27. std::exception_ptr first) noexcept;
  28. /// Obtain message associated with exception.
  29. BOOST_ASIO_DECL virtual const char* what() const
  30. noexcept;
  31. /// Obtain a pointer to the first exception.
  32. BOOST_ASIO_DECL std::exception_ptr first_exception() const;
  33. private:
  34. std::exception_ptr first_;
  35. };
  36. } // namespace asio
  37. } // namespace boost
  38. #include <boost/asio/detail/pop_options.hpp>
  39. #if defined(BOOST_ASIO_HEADER_ONLY)
  40. # include <boost/asio/impl/multiple_exceptions.ipp>
  41. #endif // defined(BOOST_ASIO_HEADER_ONLY)
  42. #endif // BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP