X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Ffatal.hpp;h=8b810e7bb44189106ed4c4658bbfafaf830ab557;hb=2897ccfa82591bd17d02c344465c4a74e3b3dbae;hp=f0ee08131614f3ee3dc8d8b1ff9bce0eeae1b024;hpb=e9c7a25491f4cf9265a926b7d9848bd70acaf7aa;p=awesomized%2Flibmemcached diff --git a/libtest/fatal.hpp b/libtest/fatal.hpp index f0ee0813..8b810e7b 100644 --- a/libtest/fatal.hpp +++ b/libtest/fatal.hpp @@ -38,67 +38,16 @@ #include -#ifndef __PRETTY_FUNCTION__ -#define __PRETTY_FUNCTION__ __func__ -#endif - -#define LIBYATL_DEFAULT_PARAM __FILE__, __LINE__, __PRETTY_FUNCTION__ - namespace libtest { -class fatal : std::runtime_error -{ -public: - fatal(const char *file, int line, const char *func, const char *format, ...); - - const char* what() const throw() - { - return _error_message; - } - - const char* mesg() const throw() - { - return _error_message; - } - - // The following are just for unittesting the exception class - static bool is_disabled(); - static void disable(); - static void enable(); - static uint32_t disabled_counter(); - static void increment_disabled_counter(); - - int line() - { - return _line; - } - - const char* file() - { - return _file; - } - - const char* func() - { - return _func; - } - -private: - char _error_message[BUFSIZ]; - char _mesg[BUFSIZ]; - int _line; - const char* _file; - const char* _func; -}; - class disconnected : std::runtime_error { public: - disconnected(const char *file, int line, const char *func, const char *instance, const in_port_t port, const char *format, ...); + disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, ...); const char* what() const throw() { - return _error_message; + return &_error_message[0]; } // The following are just for unittesting the exception class @@ -132,8 +81,4 @@ private: const char* _func; }; - } // namespace libtest - -#define fatal_message(__mesg) throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "%s", __mesg) -#define fatal_assert(__assert) if((__assert)) {} else { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "%s", #__assert); }