summaryrefslogtreecommitdiffstats
path: root/Sluift
diff options
context:
space:
mode:
Diffstat (limited to 'Sluift')
-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;
};