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 | |
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 | /// Exception thrown when there are multiple pending exceptions to rethrow. |
26 | class multiple_exceptions |
27 | : public std::exception |
28 | { |
29 | public: |
30 | /// Constructor. |
31 | BOOST_ASIO_DECL multiple_exceptions( |
32 | std::exception_ptr first) noexcept; |
33 | |
34 | /// Obtain message associated with exception. |
35 | BOOST_ASIO_DECL virtual const char* what() const |
36 | noexcept; |
37 | |
38 | /// Obtain a pointer to the first exception. |
39 | BOOST_ASIO_DECL std::exception_ptr first_exception() const; |
40 | |
41 | private: |
42 | std::exception_ptr first_; |
43 | }; |
44 | |
45 | } // namespace asio |
46 | } // namespace boost |
47 | |
48 | #include <boost/asio/detail/pop_options.hpp> |
49 | |
50 | #if defined(BOOST_ASIO_HEADER_ONLY) |
51 | # include <boost/asio/impl/multiple_exceptions.ipp> |
52 | #endif // defined(BOOST_ASIO_HEADER_ONLY) |
53 | |
54 | #endif // BOOST_ASIO_MULTIPLE_EXCEPTIONS_HPP |
55 | |