1 /*
2  *  Created by Martin on 03/09/2018.
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 
8 #include "catch_enforce.h"
9 
10 #include <stdexcept>
11 
12 
13 namespace Catch {
14 #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)
15     [[noreturn]]
throw_exception(std::exception const & e)16     void throw_exception(std::exception const& e) {
17         Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
18                       << "The message was: " << e.what() << '\n';
19         std::terminate();
20     }
21 #endif
22 
23     [[noreturn]]
throw_logic_error(std::string const & msg)24     void throw_logic_error(std::string const& msg) {
25         throw_exception(std::logic_error(msg));
26     }
27 
28     [[noreturn]]
throw_domain_error(std::string const & msg)29     void throw_domain_error(std::string const& msg) {
30         throw_exception(std::domain_error(msg));
31     }
32 
33     [[noreturn]]
throw_runtime_error(std::string const & msg)34     void throw_runtime_error(std::string const& msg) {
35         throw_exception(std::runtime_error(msg));
36     }
37 
38 
39 
40 } // namespace Catch;
41