From f813aadb2e45726780ca3ec345bbcd612f4d5177 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 22 May 2012 17:05:55 +0100
Subject: Allow SluiftExceptions to be output by the EventLoop


diff --git a/Sluift/SluiftException.h b/Sluift/SluiftException.h
index 28393ab..6964523 100644
--- a/Sluift/SluiftException.h
+++ b/Sluift/SluiftException.h
@@ -11,13 +11,15 @@
 #include <Swiften/Client/ClientError.h>
 
 namespace Swift {
-	class SluiftException {
+	class SluiftException : public std::exception {
 		public:
+			virtual ~SluiftException() throw() {}
+			
 			SluiftException(const std::string& reason) : reason(reason) {
 			}
 
 			SluiftException(const ClientError& error) {
-				std::string reason("Disconnected: ");
+				reason = "Disconnected: ";
 				switch(error.getType()) {
 					case ClientError::UnknownError: reason += "Unknown Error"; break;
 					case ClientError::DomainNameResolveError: reason += "Unable to find server"; break;
@@ -57,6 +59,11 @@ namespace Swift {
 				return reason;
 			}
 
+			virtual const char* what() const throw() {
+				return getReason().c_str();
+			}
+
+
 		private:
 			std::string reason;
 	};
-- 
cgit v0.10.2-6-g49f6