1  
//
1  
//
2  
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
2  
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
3  
//
3  
//
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  
//
6  
//
7  
// Official repository: https://github.com/boostorg/json
7  
// Official repository: https://github.com/boostorg/json
8  
//
8  
//
9  

9  

10  
#ifndef BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
10  
#ifndef BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
11  
#define BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
11  
#define BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
12  

12  

13  
#include <boost/json/detail/except.hpp>
13  
#include <boost/json/detail/except.hpp>
14  
#include <boost/version.hpp>
14  
#include <boost/version.hpp>
15  
#include <boost/throw_exception.hpp>
15  
#include <boost/throw_exception.hpp>
16  
#include <stdexcept>
16  
#include <stdexcept>
17  

17  

18  
namespace boost {
18  
namespace boost {
19  
namespace json {
19  
namespace json {
20  

20  

21  
namespace detail {
21  
namespace detail {
22  

22  

23  
void
23  
void
24  
throw_system_error(
24  
throw_system_error(
25  
    system::error_code const& ec,
25  
    system::error_code const& ec,
26  
    source_location const& loc)
26  
    source_location const& loc)
27  
{
27  
{
28  
    throw_exception(
28  
    throw_exception(
29  
        system::system_error(ec),
29  
        system::system_error(ec),
30  
        loc);
30  
        loc);
31  
}
31  
}
32  

32  

33  
void
33  
void
34  
throw_system_error(
34  
throw_system_error(
35  
    error e,
35  
    error e,
36  
    source_location const* loc)
36  
    source_location const* loc)
37  
{
37  
{
38  
    system::error_code ec;
38  
    system::error_code ec;
39  
    ec.assign(e, loc);
39  
    ec.assign(e, loc);
40  

40  

41  
    throw_exception(
41  
    throw_exception(
42  
        system::system_error(ec),
42  
        system::system_error(ec),
43  
        *loc);
43  
        *loc);
44  
}
44  
}
45  

45  

46  
} // detail
46  
} // detail
47  
} // namespace json
47  
} // namespace json
48  
} // namespace boost
48  
} // namespace boost
49  

49  

50  
#endif
50  
#endif