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:
00062 enum ErrorType {
00063 Unknown = 1,
00065 InternalServer = 2,
00066 InternalCommunication = 3,
00067 PermissionDenied = 4,
00069 EncryptionFailure,
00070 AuthServiceErr = 100,
00071
00072 MethodNotKnown,
00073 ServiceNotAvailable,
00074 InvalidQuery,
00075 IdentityErr = 200,
00076
00077 MethodNotAvailable,
00078 IdentityNotFound,
00080 StoreFailed,
00081 RemoveFailed,
00082 SignOutFailed,
00083 IdentityOperationCanceled,
00084 CredentialsNotAvailable,
00085 ReferenceNotFound,
00086 AuthSessionErr = 300,
00087
00088 MechanismNotAvailable,
00089 MissingData,
00091 InvalidCredentials,
00093 NotAuthorized,
00094 WrongState,
00096 OperationNotSupported,
00098 NoConnection,
00099 Network,
00100 Ssl,
00101 Runtime,
00102 SessionCanceled,
00103 TimedOut,
00104 UserInteraction,
00105 OperationFailed,
00106 EncryptionFailed,
00107 TOSNotAccepted,
00108 ForgotPassword,
00109 MethodOrMechanismNotAllowed,
00110 IncorrectDate,
00111 UserErr = 400
00112
00113 };
00114
00118 Error() : m_type((int)Unknown), m_message(QString()) { registerType(); }
00119
00125 Error(const Error &src) :
00126 #ifdef SIGNON_INTERNAL
00127 QObject(),
00128 #endif
00129 m_type(src.type()), m_message(src.message()) {}
00130
00136 Error(int type, const QString &message = QString()) : m_type(type), m_message(message)
00137 { registerType(); }
00138
00143 Error &operator=(const Error &src)
00144 { m_type = src.type(); m_message = src.message(); return *this; }
00145
00149 virtual ~Error() {}
00150
00158 void setType(int type) { m_type = type; }
00159
00164 void setMessage(const QString &message) { m_message = message; }
00165
00169 int type() const { return m_type; }
00170
00174 QString message() const { return m_message; }
00175
00176 private:
00177 void registerType()
00178 { qRegisterMetaType<Error>("SignOn::Error"); }
00179
00180 private:
00181 int m_type;
00182 QString m_message;
00183 };
00184
00185 }
00186
00187 Q_DECLARE_METATYPE(SignOn::Error)
00188
00189 #endif // SIGNONERROR_H