summaryrefslogtreecommitdiffstats
path: root/src/Common/Exception.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Exception.h')
-rw-r--r--src/Common/Exception.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Common/Exception.h b/src/Common/Exception.h
index 25bc56c..9862f9b 100644
--- a/src/Common/Exception.h
+++ b/src/Common/Exception.h
@@ -20,31 +20,39 @@
#ifndef MAD_COMMON_EXCEPTION_H_
#define MAD_COMMON_EXCEPTION_H_
+#include <string>
+
namespace Mad {
namespace Common {
class Exception {
public:
enum ErrorCode {
- SUCCESS = 0x0000, UNEXPECTED_PACKET = 0x0001, INVALID_ACTION = 0x0002,
- NOT_FINISHED = 0x0010,
- ALREADY_IDENTIFIED = 0x0020, UNKNOWN_DAEMON = 0x0021, DAEMON_INACTIVE = 0x0022
+ SUCCESS = 0x0000, UNEXPECTED_PACKET = 0x0001, INVALID_ACTION = 0x0002, NOT_AVAILABLE = 0x0003, NOT_FINISHED = 0x0004,
+ INTERNAL_ERRNO = 0x0010, INTERNAL_GNUTLS = 0x0011,
+ INVALID_ADDRESS = 0x0020,
+ ALREADY_IDENTIFIED = 0x0030, UNKNOWN_DAEMON = 0x0031
};
private:
+ std::string where;
+
ErrorCode errorCode;
- unsigned long subCode;
- unsigned long subSubCode;
+ long subCode;
+ long subSubCode;
public:
- Exception(ErrorCode errorCode0, unsigned long subCode0 = 0, unsigned long subSubCode0 = 0) : errorCode(errorCode0), subCode(subCode0), subSubCode(subSubCode0) {}
+ Exception(const std::string &where0, ErrorCode errorCode0, long subCode0 = 0, long subSubCode0 = 0)
+ : where(where0), errorCode(errorCode0), subCode(subCode0), subSubCode(subSubCode0) {}
+ Exception(ErrorCode errorCode0, long subCode0 = 0, long subSubCode0 = 0) : errorCode(errorCode0), subCode(subCode0), subSubCode(subSubCode0) {}
virtual ~Exception() {}
+ const std::string& getWhere() const {return where;}
ErrorCode getErrorCode() const {return errorCode;}
- unsigned long getSubCode() const {return subCode;}
- unsigned long getSubSubCode() const {return subSubCode;}
+ long getSubCode() const {return subCode;}
+ long getSubSubCode() const {return subSubCode;}
- const char* strerror() const;
+ std::string strerror() const;
};
}