diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-05-22 16:05:55 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-05-22 16:05:55 (GMT) |
commit | f813aadb2e45726780ca3ec345bbcd612f4d5177 (patch) | |
tree | 4934a6042e7c7da1ee0516daa8d41dffe8dcf67b /Sluift/SluiftException.h | |
parent | cd47e717cb2d5789a69582f2661bd110e1e72f37 (diff) | |
download | swift-contrib-f813aadb2e45726780ca3ec345bbcd612f4d5177.zip swift-contrib-f813aadb2e45726780ca3ec345bbcd612f4d5177.tar.bz2 |
Allow SluiftExceptions to be output by the EventLoop
Diffstat (limited to 'Sluift/SluiftException.h')
-rw-r--r-- | Sluift/SluiftException.h | 11 |
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; }; |