summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/column.cpp12
-rw-r--r--libdbpp/error.h4
2 files changed, 13 insertions, 3 deletions
diff --git a/libdbpp/column.cpp b/libdbpp/column.cpp
index 2028f03..c630430 100644
--- a/libdbpp/column.cpp
+++ b/libdbpp/column.cpp
@@ -1,6 +1,8 @@
#include "column.h"
#include <exception>
#include <compileTimeFormatter.h>
+#include <memory>
+#include <cxxabi.h>
namespace DB {
Column::Column(const Glib::ustring & n, unsigned int i) :
@@ -13,7 +15,15 @@ Column::~Column()
{
}
-InvalidConversion::InvalidConversion(const char * const f, const char * const t) : from(f), to(t) { }
+static
+std::string
+demangle(const char * const mangled)
+{
+ std::unique_ptr<char, decltype(&free)> r(abi::__cxa_demangle(mangled, NULL, NULL, NULL), &free);
+ return &*r;
+};
+
+InvalidConversion::InvalidConversion(const char * const f, const char * const t) : from(demangle(f)), to(demangle(t)) { }
AdHocFormatter(InvalidConversionMsg, "Invalid conversion from column type (%?) to value type (%?)");
std::string
diff --git a/libdbpp/error.h b/libdbpp/error.h
index bcb641d..99a28cb 100644
--- a/libdbpp/error.h
+++ b/libdbpp/error.h
@@ -32,8 +32,8 @@ namespace DB {
private:
std::string message() const throw() override;
- const char * from;
- const char * to;
+ const std::string from;
+ const std::string to;
};
class DLL_PUBLIC UnexpectedNullValue : public AdHoc::Exception<Error> {