throw_error.ipp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // detail/impl/throw_error.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_IMPL_THROW_ERROR_IPP
  11. #define ASIO_DETAIL_IMPL_THROW_ERROR_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/throw_error.hpp"
  17. #include "asio/system_error.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. namespace asio {
  20. namespace detail {
  21. void do_throw_error(
  22. const asio::error_code& err
  23. ASIO_SOURCE_LOCATION_PARAM)
  24. {
  25. asio::system_error e(err);
  26. asio::detail::throw_exception(e ASIO_SOURCE_LOCATION_ARG);
  27. }
  28. void do_throw_error(
  29. const asio::error_code& err,
  30. const char* location
  31. ASIO_SOURCE_LOCATION_PARAM)
  32. {
  33. asio::system_error e(err, location);
  34. asio::detail::throw_exception(e ASIO_SOURCE_LOCATION_ARG);
  35. }
  36. } // namespace detail
  37. } // namespace asio
  38. #include "asio/detail/pop_options.hpp"
  39. #endif // ASIO_DETAIL_IMPL_THROW_ERROR_IPP