00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef SIGNONERROR_H
00029 #define SIGNONERROR_H
00030
00031
00032 #ifdef SIGNON_INTERNAL
00033 #include <QObject>
00034 #endif
00035
00036 #include <QMetaType>
00037 #include <QString>
00038
00039 #include <SignOn/libsignoncommon.h>
00040
00041 namespace SignOn {
00042
00049 class SIGNON_EXPORT Error
00050 #ifdef SIGNON_INTERNAL
00051 : public QObject { Q_OBJECT
00052 #else
00053 {
00054 #endif
00055 public:
00064 enum ErrorType {
00065 Unknown = 1,
00067 InternalServer = 2,
00068 InternalCommunication = 3,
00070 PermissionDenied = 4,
00072 EncryptionFailure,
00074 AuthServiceErr = 100,
00075
00076 MethodNotKnown,
00078 ServiceNotAvailable,
00080 InvalidQuery,
00081 IdentityErr = 200,
00082
00083 MethodNotAvailable,
00084 IdentityNotFound,
00086 StoreFailed,
00087 RemoveFailed,
00088 SignOutFailed,
00089 IdentityOperationCanceled,
00091 CredentialsNotAvailable,
00092 ReferenceNotFound,
00094 AuthSessionErr = 300,
00095
00096
00097 MechanismNotAvailable,
00099 MissingData,
00101 InvalidCredentials,
00103 NotAuthorized,
00104 WrongState,
00106 OperationNotSupported,
00108 NoConnection,
00109 Network,
00110 Ssl,
00111 Runtime,
00113 SessionCanceled,
00114 TimedOut,
00115 UserInteraction,
00116 OperationFailed,
00117 EncryptionFailed,
00119 TOSNotAccepted,
00120 ForgotPassword,
00122 MethodOrMechanismNotAllowed,
00124 IncorrectDate,
00125 UserErr = 400
00126
00127 };
00128
00132 Error() : m_type((int)Unknown), m_message(QString()) { registerType(); }
00133
00139 Error(const Error &src) :
00140 #ifdef SIGNON_INTERNAL
00141 QObject(),
00142 #endif
00143 m_type(src.type()), m_message(src.message()) {}
00144
00150 Error(int type, const QString &message = QString()):
00151 m_type(type), m_message(message) { registerType(); }
00152
00157 Error &operator=(const Error &src)
00158 { m_type = src.type(); m_message = src.message(); return *this; }
00159
00163 virtual ~Error() {}
00164
00172 void setType(int type) { m_type = type; }
00173
00178 void setMessage(const QString &message) { m_message = message; }
00179
00183 int type() const { return m_type; }
00184
00188 QString message() const { return m_message; }
00189
00190 private:
00191 inline void registerType();
00192
00193 private:
00194 int m_type;
00195 QString m_message;
00196 };
00197
00198 }
00199
00200 Q_DECLARE_METATYPE(SignOn::Error)
00201
00202 void SignOn::Error::registerType() {
00203 qRegisterMetaType<SignOn::Error>("SignOn::Error");
00204 }
00205
00206 #endif // SIGNONERROR_H