• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2017, 2018 James E. King III
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 //   https://www.boost.org/LICENSE_1_0.txt)
7 //
8 // Entropy error class
9 //
10 
11 #ifndef BOOST_UUID_RANDOM_ENTROPY_ERROR_HPP
12 #define BOOST_UUID_RANDOM_ENTROPY_ERROR_HPP
13 
14 #include <boost/config.hpp>
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,
25 class BOOST_SYMBOL_VISIBLE entropy_error : public std::runtime_error
26 {
27 public:
entropy_error(boost::intmax_t errCode,const std::string & message)28     entropy_error(boost::intmax_t errCode, const std::string& message)
29         : std::runtime_error(message)
30         , m_errcode(errCode)
31     {
32     }
33 
errcode() const34     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
47