except.ipp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
  3. //
  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)
  6. //
  7. // Official repository: https://github.com/boostorg/url
  8. //
  9. #ifndef BOOST_URL_DETAIL_IMPL_EXCEPT_IPP
  10. #define BOOST_URL_DETAIL_IMPL_EXCEPT_IPP
  11. #include <boost/url/detail/except.hpp>
  12. #include <boost/throw_exception.hpp>
  13. #include <boost/system/system_error.hpp>
  14. #include <new>
  15. #include <stdexcept>
  16. namespace boost {
  17. namespace urls {
  18. namespace detail {
  19. void
  20. throw_system_error(
  21. error_code const& ec,
  22. source_location const& loc)
  23. {
  24. throw_exception(
  25. boost::system::system_error(ec), loc);
  26. }
  27. void
  28. throw_errc(
  29. errc::errc_t ev,
  30. source_location const& loc)
  31. {
  32. throw_system_error(make_error_code(ev), loc);
  33. }
  34. void
  35. throw_invalid_argument(
  36. source_location const& loc)
  37. {
  38. throw_errc(errc::invalid_argument, loc);
  39. }
  40. void
  41. throw_length_error(
  42. source_location const& loc)
  43. {
  44. throw_errc(errc::value_too_large, loc);
  45. }
  46. } // detail
  47. } // url
  48. } // boost
  49. #endif