]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2017, 2018 James E. King III |
11fdf7f2 TL |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // (See accompanying file LICENSE_1_0.txt or copy at | |
92f5a8d4 | 6 | // https://www.boost.org/LICENSE_1_0.txt) |
11fdf7f2 TL |
7 | // |
8 | // Entropy error class | |
9 | // | |
10 | ||
11 | #ifndef BOOST_UUID_RANDOM_ENTROPY_ERROR_HPP | |
12 | #define BOOST_UUID_RANDOM_ENTROPY_ERROR_HPP | |
13 | ||
92f5a8d4 | 14 | #include <boost/config.hpp> |
11fdf7f2 TL |
15 | #include <boost/cstdint.hpp> |
16 | #include <stdexcept> | |
17 | #include <string> | |
18 | ||
19 | namespace boost { | |
20 | namespace uuids { | |
21 | ||
22 | //! \brief Given boost::system::system_error is in a module that | |
23 | //! is not header-only, we define our own exception type | |
24 | //! to handle entropy provider errors instead, | |
92f5a8d4 | 25 | class BOOST_SYMBOL_VISIBLE entropy_error : public std::runtime_error |
11fdf7f2 TL |
26 | { |
27 | public: | |
28 | entropy_error(boost::intmax_t errCode, const std::string& message) | |
29 | : std::runtime_error(message) | |
30 | , m_errcode(errCode) | |
31 | { | |
32 | } | |
33 | ||
34 | virtual boost::intmax_t errcode() const | |
35 | { | |
36 | return m_errcode; | |
37 | } | |
38 | ||
39 | private: | |
40 | boost::intmax_t m_errcode; | |
41 | }; | |
42 | ||
43 | } // uuids | |
44 | } // boost | |
45 | ||
46 | #endif // BOOST_UUID_RANDOM_ENTROPY_ERROR_HPP |