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/url
7  
// Official repository: https://github.com/boostorg/url
8  
//
8  
//
9  

9  

10  

10  

11  
#include <boost/url/detail/config.hpp>
11  
#include <boost/url/detail/config.hpp>
12  
#include <boost/url/detail/except.hpp>
12  
#include <boost/url/detail/except.hpp>
13  
#include <boost/throw_exception.hpp>
13  
#include <boost/throw_exception.hpp>
14  
#include <boost/system/system_error.hpp>
14  
#include <boost/system/system_error.hpp>
15  
#include <new>
15  
#include <new>
16  
#include <stdexcept>
16  
#include <stdexcept>
17  

17  

18  
namespace boost {
18  
namespace boost {
19  
namespace urls {
19  
namespace urls {
20  
namespace detail {
20  
namespace detail {
21  

21  

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

30  

31  
void
31  
void
32  
throw_errc(
32  
throw_errc(
33  
    boost::system::errc::errc_t ev,
33  
    boost::system::errc::errc_t ev,
34  
    source_location const& loc)
34  
    source_location const& loc)
35  
{
35  
{
36  
    throw_system_error(make_error_code(ev), loc);
36  
    throw_system_error(make_error_code(ev), loc);
37  
}
37  
}
38  

38  

39  
void
39  
void
40  
throw_invalid_argument(
40  
throw_invalid_argument(
41  
    source_location const& loc)
41  
    source_location const& loc)
42  
{
42  
{
43  
    throw_errc(boost::system::errc::invalid_argument, loc);
43  
    throw_errc(boost::system::errc::invalid_argument, loc);
44  
}
44  
}
45  

45  

46  
void
46  
void
47  
throw_length_error(
47  
throw_length_error(
48  
    source_location const& loc)
48  
    source_location const& loc)
49  
{
49  
{
50  
    throw_errc(boost::system::errc::value_too_large, loc);
50  
    throw_errc(boost::system::errc::value_too_large, loc);
51  
}
51  
}
52  

52  

53  
} // detail
53  
} // detail
54  
} // url
54  
} // url
55  
} // boost
55  
} // boost
56  

56