summaryrefslogtreecommitdiff
path: root/lib/Exceptions.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Exceptions.cc')
-rw-r--r--lib/Exceptions.cc30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc
index 9d2ba8e..585b946 100644
--- a/lib/Exceptions.cc
+++ b/lib/Exceptions.cc
@@ -9,9 +9,21 @@
char GeneralException::t[BUFSIZ];
-GeneralException::GeneralException(String emsg) : msg(emsg.strdup()) { }
-GeneralException::GeneralException() : msg(0) { }
-GeneralException::GeneralException(const GeneralException & e) : msg(strdup(e.msg)) { }
+GeneralException::GeneralException(String emsg) : msg(emsg.strdup()) {
+#ifdef DEBUG
+ cerr << "Generating a General Exception error: '" << msg << "'.\n";
+#endif
+}
+GeneralException::GeneralException() : msg(0) {
+#ifdef DEBUG
+ cerr << "Generating a General Exception error: '" << msg << "'.\n";
+#endif
+}
+GeneralException::GeneralException(const GeneralException & e) : msg(strdup(e.msg)) {
+#ifdef DEBUG
+ cerr << "Generating a General Exception error: '" << msg << "'.\n";
+#endif
+}
GeneralException::~GeneralException() {
free(msg);
@@ -36,9 +48,17 @@ IOGeneral::IOGeneral(String fn) : GeneralException(fn) { }
IOGeneral::IOGeneral() { }
-IOAgain::IOAgain() : IOGeneral(_("No more bytes for reading or writing.")) { }
+IOAgain::IOAgain() : IOGeneral(_("No more bytes for reading or writing.")) {
+#ifdef DEBUG
+ cerr << "Generating an IOAgain exception: '" << GetMsg() << "'.\n";
+#endif
+}
-TaskSwitch::TaskSwitch() : GeneralException(_("Switching task in a non-tasked environnement")) { }
+TaskSwitch::TaskSwitch() : GeneralException(_("Switching task in a non-tasked environnement")) {
+#ifdef DEBUG
+ cerr << "Generating a TaskSwitch exception: '" << GetMsg() << "'.\n";
+#endif
+}
char * xstrdup(const char * s) throw (GeneralException) {
char * r;