signonerror.h
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2016 Canonical Ltd.
*
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef SIGNONERROR_H
#define SIGNONERROR_H
#ifdef SIGNON_INTERNAL
#include <QObject>
#endif
#include <QMetaType>
#include <QString>
#include <SignOn/libsignoncommon.h>
namespace SignOn {
class SIGNON_EXPORT Error
#ifdef SIGNON_INTERNAL
: public QObject { Q_OBJECT
#else
{
#endif
public:
enum ErrorType {
Unknown = 1,
InternalServer = 2,
InternalCommunication = 3,
PermissionDenied = 4,
EncryptionFailure,
AuthServiceErr = 100, /* Placeholder to rearrange enumeration
- AuthService specific */
MethodNotKnown,
ServiceNotAvailable,
InvalidQuery,
IdentityErr = 200, /* Placeholder to rearrange enumeration
- Identity specific */
MethodNotAvailable,
IdentityNotFound,
StoreFailed,
RemoveFailed,
SignOutFailed,
IdentityOperationCanceled,
CredentialsNotAvailable,
ReferenceNotFound,
AuthSessionErr = 300, /* Placeholder to rearrange enumeration
- AuthSession/AuthPluginInterface
specific */
MechanismNotAvailable,
MissingData,
InvalidCredentials,
NotAuthorized,
WrongState,
OperationNotSupported,
NoConnection,
Network,
Ssl,
Runtime,
SessionCanceled,
TimedOut,
UserInteraction,
OperationFailed,
EncryptionFailed,
TOSNotAccepted,
ForgotPassword,
MethodOrMechanismNotAllowed,
IncorrectDate,
UserErr = 400 /* Placeholder to rearrange enumeration
- User space specific */
};
Error() : m_type((int)Unknown), m_message(QString()) { registerType(); }
Error(const Error &src) :
#ifdef SIGNON_INTERNAL
QObject(),
#endif
m_type(src.type()), m_message(src.message()) {}
Error(int type, const QString &message = QString()):
m_type(type), m_message(message) { registerType(); }
Error &operator=(const Error &src)
{ m_type = src.type(); m_message = src.message(); return *this; }
virtual ~Error() {}
void setType(int type) { m_type = type; }
void setMessage(const QString &message) { m_message = message; }
int type() const { return m_type; }
QString message() const { return m_message; }
private:
inline void registerType();
private:
int m_type;
QString m_message;
};
} //namespace SignOn
Q_DECLARE_METATYPE(SignOn::Error)
void SignOn::Error::registerType() {
qRegisterMetaType<SignOn::Error>("SignOn::Error");
}
#endif // SIGNONERROR_H
SignOn::Error
definition for Signon error handling.
Definition: signonerror.h:53
SignOn::Error::Error
Error(const Error &src)
Copy constructor.
Definition: signonerror.h:139
SignOn::Error::Error
Error(int type, const QString &message=QString())
For convenience constructor.
Definition: signonerror.h:150
SignOn::Error::message
QString message() const
Definition: signonerror.h:188
SignOn::Error::operator=
Error & operator=(const Error &src)
Assignment operator.
Definition: signonerror.h:157
SignOn::Error::ErrorType
ErrorType
Error codes for all the Signon by default supported errors.
Definition: signonerror.h:64
SignOn::Error::OperationFailed
@ OperationFailed
Definition: signonerror.h:116
SignOn::Error::NoConnection
@ NoConnection
Definition: signonerror.h:108
SignOn::Error::TimedOut
@ TimedOut
Definition: signonerror.h:114
SignOn::Error::StoreFailed
@ StoreFailed
Definition: signonerror.h:86
SignOn::Error::RemoveFailed
@ RemoveFailed
Definition: signonerror.h:87
SignOn::Error::UserInteraction
@ UserInteraction
Definition: signonerror.h:115
SignOn::Error::TOSNotAccepted
@ TOSNotAccepted
Definition: signonerror.h:119
SignOn::Error::IncorrectDate
@ IncorrectDate
Definition: signonerror.h:124
SignOn::Error::InvalidQuery
@ InvalidQuery
Definition: signonerror.h:80
SignOn::Error::Ssl
@ Ssl
Definition: signonerror.h:110
SignOn::Error::SignOutFailed
@ SignOutFailed
Definition: signonerror.h:88
SignOn::Error::Network
@ Network
Definition: signonerror.h:109
SignOn::Error::CredentialsNotAvailable
@ CredentialsNotAvailable
Definition: signonerror.h:91
SignOn::Error::MethodNotAvailable
@ MethodNotAvailable
Definition: signonerror.h:83
SignOn::Error::NotAuthorized
@ NotAuthorized
Definition: signonerror.h:103
SignOn::Error::SessionCanceled
@ SessionCanceled
Definition: signonerror.h:113
SignOn::Error::type
int type() const
Definition: signonerror.h:183
SignOn::Error::setType
void setType(int type)
Sets the type of the error.
Definition: signonerror.h:172
SignOn::Error::setMessage
void setMessage(const QString &message)
Sets the error message.
Definition: signonerror.h:178
SignOn::Error::~Error
virtual ~Error()
Destructor.
Definition: signonerror.h:163
SignOn::Error::Error
Error()
Constructor.
Definition: signonerror.h:132
SignOn
Definition: async-dbus-proxy.cpp:41