Merge up to gearmand.
[m6w6/libmemcached] / libtest / fatal.hpp
index bc288afeb767cf72498ee86348364dc830c5039f..7a8ce5161491173670359ed67ca08dad9a807478 100644 (file)
 #define __PRETTY_FUNCTION__ __func__
 #endif
 
+#define YATL_STRINGIFY(x) #x
+#define YATL_TOSTRING(x) YATL_STRINGIFY(x)
+#define YATL_AT __FILE__ ":" YATL_TOSTRING(__LINE__)
+#define YATL_AT_PARAM __func__, AT
+#define YATL_UNIQUE __FILE__ ":" YATL_TOSTRING(__LINE__) "_unique"
+#define YATL_UNIQUE_FUNC_NAME __FILE__ ":" YATL_TOSTRING(__LINE__) "_unique_func"
+
 #define LIBYATL_DEFAULT_PARAM __FILE__, __LINE__, __PRETTY_FUNCTION__
 
 namespace libtest {
@@ -56,6 +63,11 @@ public:
     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();
@@ -63,8 +75,27 @@ public:
   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
@@ -84,10 +115,28 @@ public:
   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];
   in_port_t _port;
   char _instance[1024];
+  int _line;
+  const char*  _file;
+  const char* _func;
 };