except.ipp 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // Copyright (c) 2019 Vinnie Falco ([email protected])
  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/json
  8. //
  9. #ifndef BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
  10. #define BOOST_JSON_DETAIL_IMPL_EXCEPT_IPP
  11. #include <boost/json/detail/except.hpp>
  12. #include <boost/version.hpp>
  13. #include <boost/throw_exception.hpp>
  14. #include <stdexcept>
  15. namespace boost {
  16. namespace json {
  17. namespace detail {
  18. void
  19. throw_system_error(
  20. system::error_code const& ec,
  21. source_location const& loc)
  22. {
  23. throw_exception(
  24. system::system_error(ec),
  25. loc);
  26. }
  27. void
  28. throw_system_error(
  29. error e,
  30. source_location const* loc)
  31. {
  32. system::error_code ec;
  33. ec.assign(e, loc);
  34. throw_exception(
  35. system::system_error(ec),
  36. *loc);
  37. }
  38. } // detail
  39. } // namespace json
  40. } // namespace boost
  41. #endif