except.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. namespace boost {
  13. namespace json {
  14. namespace detail {
  15. #define BOOST_JSON_FAIL(ec, e) \
  16. BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION; \
  17. (ec).assign(e, &loc);
  18. BOOST_JSON_DECL void BOOST_NORETURN throw_bad_alloc(source_location const& loc = BOOST_CURRENT_LOCATION);
  19. BOOST_JSON_DECL void BOOST_NORETURN throw_invalid_argument(char const* what, source_location const& loc = BOOST_CURRENT_LOCATION);
  20. BOOST_JSON_DECL void BOOST_NORETURN throw_length_error(char const* what, source_location const& loc = BOOST_CURRENT_LOCATION);
  21. BOOST_JSON_DECL void BOOST_NORETURN throw_out_of_range(source_location const& loc = BOOST_CURRENT_LOCATION);
  22. BOOST_JSON_DECL void BOOST_NORETURN throw_system_error(error_code const& ec, source_location const& loc = BOOST_CURRENT_LOCATION);
  23. } // detail
  24. } // namespace json
  25. } // namespace boost
  26. #endif