]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/variant.cpp
Improve error reporting in Variant
[libs/core.git] / source / core / variant.cpp
diff --git a/source/core/variant.cpp b/source/core/variant.cpp
new file mode 100644 (file)
index 0000000..1cdc0a5
--- /dev/null
@@ -0,0 +1,13 @@
+#include <msp/debug/demangle.h>
+#include <msp/strings/formatter.h>
+#include "variant.h"
+
+using namespace std;
+
+namespace Msp {
+
+type_mismatch::type_mismatch(const type_info &e, const type_info &a):
+       runtime_error(format("expected: %s\nactual: %s", Debug::demangle(e.name()), Debug::demangle(a.name())))
+{ }
+
+}