except.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/json
  8. //
  9. #ifndef BOOST_JSON_DETAIL_EXCEPT_HPP
  10. #define BOOST_JSON_DETAIL_EXCEPT_HPP
  11. #include <boost/json/error.hpp>
  12. #ifndef BOOST_JSON_STANDALONE
  13. #include <boost/assert/source_location.hpp>
  14. #include <boost/exception/diagnostic_information.hpp>
  15. #endif
  16. BOOST_JSON_NS_BEGIN
  17. namespace detail {
  18. #if ! defined(BOOST_JSON_STANDALONE) && defined(BOOST_CURRENT_LOCATION)
  19. # define BOOST_JSON_SOURCE_POS BOOST_CURRENT_LOCATION
  20. using source_location = boost::source_location;
  21. #else
  22. # define BOOST_JSON_SOURCE_POS {}
  23. struct source_location{};
  24. #endif
  25. BOOST_JSON_DECL void BOOST_NORETURN throw_bad_alloc(source_location const& loc);
  26. BOOST_JSON_DECL void BOOST_NORETURN throw_invalid_argument(char const* what, source_location const& loc);
  27. BOOST_JSON_DECL void BOOST_NORETURN throw_length_error(char const* what, source_location const& loc);
  28. BOOST_JSON_DECL void BOOST_NORETURN throw_out_of_range(source_location const& loc);
  29. BOOST_JSON_DECL void BOOST_NORETURN throw_system_error(error_code const& ec, source_location const& loc);
  30. } // detail
  31. BOOST_JSON_NS_END
  32. #endif