Astra Linux Directory Client Core API  1.7.0
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
ALDException.h
См. документацию.
1 
6 #ifndef ALD_EXCEPTION
7 #define ALD_EXCEPTION
8 
9 #include <string>
10 #include <list>
11 #include <exception>
12 #include "cerrno"
13 
14 namespace ALD
15 {
16 
17 using namespace std;
24 #define THROW_ALD_ERROR(err, msg) throw err(msg, "")
26 #define THROW_ALD_ERROR_DET(err, msg, det) throw err(msg, det)
27 #define THROW_TRACE_ALD_ERROR(err, msg) throw err(msg, "", __FILE__, __FUNCTION__, __LINE__)
28 #define THROW_TRACE_ALD_ERROR_DET(err, msg) throw err(msg, det, __FILE__, __FUNCTION__, __LINE__)
29 
30 #define ALD_ERROR(msg) THROW_ALD_ERROR(EALDError, msg)
31 #define ALD_ERROR_DET(msg, det) THROW_ALD_ERROR_DET(EALDError, msg, det)
32 
33 #define ALD_CHECK_PTR_DESC(ptr, desc) {if(!(ptr)) THROW_TRACE_ALD_ERROR(EALDOutOfMemory, desc);}
34 #define ALD_CHECK_PTR(ptr) ALD_CHECK_PTR_DESC(ptr, "")
35 
36 #define ALD_INTERNAL_ERROR(msg) THROW_TRACE_ALD_ERROR(EALDInternalError, msg)
37 
38 #define ALD_CHECK(condition, desc) {if(!(condition)) THROW_ALD_ERROR(EALDCheckError, desc);}
39 
40 #define ALD_SIGINT throw EALDSigIntError()
41 
42 #define ALD_SIGTERM throw EALDSigTermError()
43 
44 #define ALD_PERM_ERROR(msg) THROW_ALD_ERROR(EALDPermError, msg)
45 
50 class EALDError: public exception
51 {
52 protected:
53  string m_strMsg;
54  string m_strDetails;
55  string m_strWhat;
56  int m_ierrcode;
57  virtual void makewhat();
59 public:
64  explicit EALDError(const string &strMsg, const string &strDetails);
65 
73  explicit EALDError(const string &strMsg, const string &strDetails, const string &strFile, const string &strFunc, unsigned long ulLine);
75  virtual const char* what() const throw();
77  virtual const char* msg() const throw();
79  virtual const char* details() const throw();
81  virtual int errcode() const;
82  virtual ~EALDError() throw();
83 };
84 
89 {
90 public:
92  explicit EALDOutOfMemory(const string &strMsg, const string &strDetails);
94  explicit EALDOutOfMemory(const string &strMsg, const string &strDetails, const string &strFile, const string &strFunc, unsigned long ulLine);
95  virtual ~EALDOutOfMemory() throw();
96 };
97 
102 {
103 public:
105  explicit EALDInternalError(const string &strMsg, const string &strDetails);
107  explicit EALDInternalError(const string &strMsg, const string &strDetails, const string &strFile, const string &strFunc, unsigned long ulLine);
108  virtual ~EALDInternalError() throw();
109 };
110 
115 {
116 public:
118  explicit EALDCheckError(const string &strMsg, const string &strDetails);
120  explicit EALDCheckError(const string &strMsg, const string &strDetails, const string &strFile, const string &strFunc, unsigned long ulLine);
121  virtual ~EALDCheckError() throw();
122 };
123 
128 {
129 public:
130  explicit EALDSigIntError();
131  virtual ~EALDSigIntError() throw();
132 };
133 
138 {
139 public:
141  explicit EALDPermError(const string &strMsg, const string &strDetails);
142  virtual ~EALDPermError() throw();
143 };
144 
145 // ALD error code for exit status
147 #define ALD_ERR_BASE 100
149 #define ALD_ERR_NO_ERR 0
150 #define ALD_ERR_OUT_OF_MEMORY ENOMEM
151 #define ALD_ERR_UNKNOWN ALD_ERR_BASE+1
152 #define ALD_ERR_INTERNAL ALD_ERR_BASE+2
153 #define ALD_ERR_KERBEROS ALD_ERR_BASE+3
154 #define ALD_ERR_LDAP ALD_ERR_BASE+4
155 #define ALD_ERR_EXEC ALD_ERR_BASE+5
156 #define ALD_ERR_CONFIG ALD_ERR_BASE+6
157 #define ALD_ERR_CONDITIONS ALD_ERR_BASE+7
158 #define ALD_ERR_IN_FORCE ALD_ERR_BASE+8
159 #define ALD_ERR_NOT_FOUND ALD_ERR_BASE+9
160 #define ALD_ERR_REFUSE ALD_ERR_BASE+10
161 #define ALD_ERR_FILE_IO ALD_ERR_BASE+11
162 #define ALD_ERR_USAGE ALD_ERR_BASE+12
163 #define ALD_ERR_PERMISSION ALD_ERR_BASE+13
164 
167 } // ALD
168 
169 #endif //ALD_EXCEPTION
Класс исключения сигнала прерывания SigInt.
Definition: ALDException.h:127
string m_strMsg
Сообщение
Definition: ALDException.h:53
Класс исключения ошибки выделения памяти
Definition: ALDException.h:88
string m_strWhat
Сформированная строка What.
Definition: ALDException.h:55
Класс исключения по внутренней ошибке
Definition: ALDException.h:101
Класс исключения проверки
Definition: ALDException.h:114
Класс исключения отказа доступа
Definition: ALDException.h:137
int m_ierrcode
Definition: ALDException.h:56
string m_strDetails
Дополнительная информация
Definition: ALDException.h:54
Базовый класс исключения Astra Linux Directory.
Definition: ALDException.h:50