summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-05-22 16:05:55 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-05-22 16:05:55 (GMT)
commitf813aadb2e45726780ca3ec345bbcd612f4d5177 (patch)
tree4934a6042e7c7da1ee0516daa8d41dffe8dcf67b
parentcd47e717cb2d5789a69582f2661bd110e1e72f37 (diff)
downloadswift-f813aadb2e45726780ca3ec345bbcd612f4d5177.zip
swift-f813aadb2e45726780ca3ec345bbcd612f4d5177.tar.bz2
Allow SluiftExceptions to be output by the EventLoop
-rw-r--r--Sluift/SluiftException.h11
1 files changed, 9 insertions, 2 deletions
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;
};