6 #define Ugly_Function_Name __FUNCSIG__
8 #define Ugly_Function_Name __PRETTY_FUNCTION__
28 stream <<
"Has std::exception virtual destructor ? "
29 << std::has_virtual_destructor_v< std::exception > <<
tpf::endl;
31 stream <<
"Has std::vector<int> virtual destructor ? "
32 << std::has_virtual_destructor_v< std::vector<int> > <<
tpf::endl;
47 std::string m_message;
49 std::string m_function_name;
50 std::string m_file_name;
51 std::string m_what_msg;
55 int lineno = 0, std::string function_name =
"",
56 std::string file_name =
""):
57 m_message{message}, m_lineno{lineno},
58 m_function_name{function_name}, m_file_name{file_name}
60 std::ostringstream os;
62 os <<
"exception_debug - file [" << this->m_file_name <<
"] \n";
63 os <<
"thread id [" << std::this_thread::get_id() <<
"] - ";
64 os <<
"line number [" << this->m_lineno <<
"] - ";
65 os <<
"function [" << this->m_function_name <<
"]\n";
66 os <<
"message: " << this->m_message;
68 this->m_what_msg = os.str();
72 virtual const char*
what() const noexcept
override
76 return this->m_what_msg.c_str();
81#define UglyNamed_ThrowException(message) throw exception_debug(message, __LINE__, Ugly_Function_Name, __FILE__)
102 catch(std::exception& e)
#define UglyNamed_ThrowException(message)
void test_virtual_destructor()
int division(int a, int b)
void example_for_throw_debug_exception()
virtual const char * what() const noexcept override
exception_debug(std::string message="", int lineno=0, std::string function_name="", std::string file_name="")
Stream output operators << are implemented.