1 #ifndef TUT_EXCEPTION_H_GUARD
2 #define TUT_EXCEPTION_H_GUARD
5 #include "tut_result.hpp"
11 * The base for all TUT exceptions.
13 struct tut_error : public std::exception
15 tut_error(const std::string& msg)
20 virtual test_result::result_type result() const
22 return test_result::ex;
25 const char* what() const throw()
27 return err_msg.c_str();
40 * Group not found exception.
42 struct no_such_group : public tut_error
44 no_such_group(const std::string& grp)
49 ~no_such_group() throw()
55 * Internal exception to be throwed when
56 * test constructor has failed.
58 struct bad_ctor : public tut_error
60 bad_ctor(const std::string& msg)
65 test_result::result_type result() const
67 return test_result::ex_ctor;
76 * Exception to be throwed when ensure() fails or fail() called.
78 struct failure : public tut_error
80 failure(const std::string& msg)
85 test_result::result_type result() const
87 return test_result::fail;
96 * Exception to be throwed when test desctructor throwed an exception.
98 struct warning : public tut_error
100 warning(const std::string& msg)
105 test_result::result_type result() const
107 return test_result::warn;
116 * Exception to be throwed when test issued SEH (Win32)
118 struct seh : public tut_error
120 seh(const std::string& msg)
125 virtual test_result::result_type result() const
127 return test_result::term;
136 * Exception to be throwed when child processes fail.
138 struct rethrown : public failure
140 explicit rethrown(const test_result &result)
141 : failure(result.message), tr(result)
145 virtual test_result::result_type result() const
147 return test_result::rethrown;
154 const test_result tr;