summaryrefslogtreecommitdiff
path: root/service/uptr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'service/uptr.cpp')
-rw-r--r--service/uptr.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/service/uptr.cpp b/service/uptr.cpp
new file mode 100644
index 0000000..1669a69
--- /dev/null
+++ b/service/uptr.cpp
@@ -0,0 +1,26 @@
+#include "uptr.h"
+#include <execinfo.h>
+#include <boost/assert.hpp>
+#include <string>
+#include <stdlib.h>
+#include <exception>
+
+namespace MirrorSearch {
+
+ std::string
+ failingFunction(void * const func)
+ {
+ char ** fn = backtrace_symbols(&func, 1);
+ BOOST_ASSERT(fn);
+ BOOST_ASSERT(*fn);
+ std::string funcName(*fn);
+ free(fn);
+ return funcName;
+ }
+
+ void
+ defaultErrorHandler(const std::string & fn)
+ {
+ throw std::runtime_error("Fatal error in " + fn);
+ }
+}