9 #ifndef _RMS_LIB_EXCEPTIONS_H
10 #define _RMS_LIB_EXCEPTIONS_H
18 # define _NOEXCEPT _GLIBCXX_USE_NOEXCEPT
19 # endif // if __GNUC__ >= 4
20 #endif // ifndef _NOEXCEPT
23 namespace exceptions {
24 #define MAX_EXCEPTION_MESSAGE_LENGTH 255
58 const std::string & message) _NOEXCEPT
59 : type_(type), error_(error)
61 CopyMessage(message.c_str(), message.length());
69 const char *
const & message) _NOEXCEPT
70 : type_(type), error_(error)
72 CopyMessage(message, strlen(message));
78 virtual ~RMSException() _NOEXCEPT {}
83 virtual const char* what() const _NOEXCEPT
override {
97 virtual int error() const _NOEXCEPT {
103 void CopyMessage(
const char *msg,
const size_t len) {
105 (std::min)(len, static_cast<const size_t>(MAX_EXCEPTION_MESSAGE_LENGTH - 1));
107 memset(message_, 0,
sizeof(message_));
111 memcpy_s(message_, mlen, msg, mlen);
112 #else // ifdef Q_OS_WIN32
113 memcpy(message_, msg, mlen);
114 #endif // ifdef Q_OS_WIN32
120 char message_[MAX_EXCEPTION_MESSAGE_LENGTH];
133 const std::string& message) _NOEXCEPT
140 const char *
const& message) _NOEXCEPT
250 RMSNetworkException(
const char *
const& message,
Reason reason) _NOEXCEPT
251 : RMSLogicException(NetworkError, message), reason_(reason) {}
256 virtual ~RMSNetworkException() _NOEXCEPT {}
261 virtual Reason reason() const _NOEXCEPT {
342 RMSPFileException(
const char *
const& message,
Reason reason) _NOEXCEPT
343 : RMSLogicException(PFileError, message), reason_(reason) {}
348 virtual ~RMSPFileException() _NOEXCEPT {}
353 virtual Reason reason() const _NOEXCEPT {
387 #endif // _RMS_LIB_EXCEPTIONS_H
Network error.
Definition: RMSExceptions.h:224
Logic error.
Definition: RMSExceptions.h:126
Stream error.
Definition: RMSExceptions.h:297
RMS Error.
Definition: RMSExceptions.h:29
Rights error.
Definition: RMSExceptions.h:365
Definition: AuthenticationCallbackImpl.h:16
Reason
Possible seasons for network error.
Definition: RMSExceptions.h:230
ErrorTypes
Type of error.
Definition: RMSExceptions.h:42
File error.
Definition: RMSExceptions.h:321
Invalid argument.
Definition: RMSExceptions.h:152
Reason
Reasons for file error.
Definition: RMSExceptions.h:327
Null pointer.
Definition: RMSExceptions.h:176
Cryptographic error.
Definition: RMSExceptions.h:273
Not found.
Definition: RMSExceptions.h:200
ExceptionTypes
Type of exception.
Definition: RMSExceptions.h:35