summaryrefslogtreecommitdiff
path: root/project2/common/exceptions.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-02-12 14:39:28 +0000
committerrandomdan <randomdan@localhost>2012-02-12 14:39:28 +0000
commit226d35215412aed267c7d5939f1c7fae5158cae9 (patch)
treedebeb5af1f05909003f8a8ace816f4578e5af587 /project2/common/exceptions.cpp
parentAdd some more aggregates (diff)
downloadproject2-226d35215412aed267c7d5939f1c7fae5158cae9.tar.bz2
project2-226d35215412aed267c7d5939f1c7fae5158cae9.tar.xz
project2-226d35215412aed267c7d5939f1c7fae5158cae9.zip
Adds support for presenter level caching modules and implements a file based one (requires xattr support)
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 2fa5509..4f061ab 100644
--- a/project2/common/exceptions.cpp
+++ b/project2/common/exceptions.cpp
@@ -48,3 +48,26 @@ two_part_error::what() const throw()
return buf;
}
+
+syscall_error::syscall_error(int e) :
+ err(e),
+ buf(NULL)
+{
+}
+
+syscall_error::~syscall_error() throw()
+{
+ free(buf);
+}
+
+const char *
+syscall_error::what() const throw()
+{
+ if (!buf) {
+ if (asprintf(&buf, "%s (%d)", strerror(err), err) < 1) {
+ throw std::bad_alloc();
+ }
+ }
+ return buf;
+}
+