summaryrefslogtreecommitdiff
path: root/project2/common/exceptions.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-12-14 21:42:31 +0000
committerrandomdan <randomdan@localhost>2011-12-14 21:42:31 +0000
commit8a7980bff41ccb8dc42b18eb1edd4b3938977fc3 (patch)
tree4b0a3414ba881a3118630c41ca24129d23f996df /project2/common/exceptions.cpp
parentDon't write JSON numbers in scientific notation, use native C++ boolalpha for... (diff)
downloadproject2-8a7980bff41ccb8dc42b18eb1edd4b3938977fc3.tar.bz2
project2-8a7980bff41ccb8dc42b18eb1edd4b3938977fc3.tar.xz
project2-8a7980bff41ccb8dc42b18eb1edd4b3938977fc3.zip
Pluggable script engines
XML script parser moved to XML module Script parsing object multiple instantiation bug fix Scripts changed to match new standardized format and layout
Diffstat (limited to 'project2/common/exceptions.cpp')
-rw-r--r--project2/common/exceptions.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/project2/common/exceptions.cpp b/project2/common/exceptions.cpp
index d347f5f..2fa5509 100644
--- a/project2/common/exceptions.cpp
+++ b/project2/common/exceptions.cpp
@@ -25,3 +25,26 @@ numeric_error::what() const throw()
return buf;
}
+two_part_error::two_part_error(const std::string & w1, const std::string & w2) :
+ what1(w1),
+ what2(w2),
+ buf(NULL)
+{
+}
+
+two_part_error::~two_part_error() throw()
+{
+ free(buf);
+}
+
+const char *
+two_part_error::what() const throw()
+{
+ if (!buf) {
+ if (asprintf(&buf, "%s, %s", what1.c_str(), what2.c_str()) < 1) {
+ throw std::bad_alloc();
+ }
+ }
+ return buf;
+}
+