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 
11 #ifndef BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP
12 #define BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include <boost/asio/detail/config.hpp>
19 #include <exception>
20 #include <boost/asio/detail/push_options.hpp>
21 
22 namespace boost {
23 namespace asio {
24 
25 #if defined(BOOST_ASIO_HAS_STD_EXCEPTION_PTR) \
26   || defined(GENERATING_DOCUMENTATION)
27 
28 /// Exception thrown when there are multiple pending exceptions to rethrow.
29 class multiple_exceptions
30   : public std::exception
31 {
32 public:
33   /// Constructor.
34   BOOST_ASIO_DECL multiple_exceptions(
35       std::exception_ptr first) BOOST_ASIO_NOEXCEPT;
36 
37   /// Obtain message associated with exception.
38   BOOST_ASIO_DECL virtual const char* what() const
39     BOOST_ASIO_NOEXCEPT_OR_NOTHROW;
40 
41   /// Obtain a pointer to the first exception.
42   BOOST_ASIO_DECL std::exception_ptr first_exception() const;
43 
44 private:
45   std::exception_ptr first_;
46 };
47 
48 #endif // defined(BOOST_ASIO_HAS_STD_EXCEPTION_PTR)
49        //   || defined(GENERATING_DOCUMENTATION)
50 
51 } // namespace asio
52 } // namespace boost
53 
54 #include <boost/asio/detail/pop_options.hpp>
55 
56 #if defined(BOOST_ASIO_HEADER_ONLY)
57 # include <boost/asio/impl/multiple_exceptions.ipp>
58 #endif // defined(BOOST_ASIO_HEADER_ONLY)
59 
60 #endif // BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP
61