~xavi-garcia-mena/keeper/one-drive-provider

« back to all changes in this revision

Viewing changes to src/client/keeper-errors.cpp

  • Committer: Xavi Garcia Mena
  • Date: 2016-12-22 12:19:13 UTC
  • Revision ID: xavi.garcia.mena@canonical.com-20161222121913-85l1lcgdnb9708ae
KeeperError as Error and error codes changed

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <QDebug>
23
23
 
24
 
QDBusArgument &operator<<(QDBusArgument &argument, keeper::KeeperError value)
 
24
QDBusArgument &operator<<(QDBusArgument &argument, keeper::Error value)
25
25
{
26
26
    argument.beginStructure();
27
27
    argument << static_cast<int>(value);
29
29
    return argument;
30
30
}
31
31
 
32
 
const QDBusArgument &operator>>(const QDBusArgument &argument, keeper::KeeperError &val)
 
32
const QDBusArgument &operator>>(const QDBusArgument &argument, keeper::Error &val)
33
33
{
34
34
    int int_val;
35
35
    argument.beginStructure();
36
36
    argument >> int_val;
37
 
    val = static_cast<keeper::KeeperError>(int_val);
 
37
    val = static_cast<keeper::Error>(int_val);
38
38
    argument.endStructure();
39
39
    return argument;
40
40
}
41
41
 
42
42
namespace keeper
43
43
{
44
 
KeeperError convert_from_dbus_variant(const QVariant & value, bool *conversion_ok)
 
44
Error convert_from_dbus_variant(const QVariant & value, bool *conversion_ok)
45
45
{
46
46
    if (value.typeName() != QStringLiteral("QDBusArgument"))
47
47
    {
48
48
        qWarning() << Q_FUNC_INFO
49
 
                   << " Error converting dbus QVariant to KeeperError, expected type is [ QDBusArgument ] and current type is: ["
 
49
                   << " Error converting dbus QVariant to Error, expected type is [ QDBusArgument ] and current type is: ["
50
50
                   << value.typeName() << "]";
51
51
        if (conversion_ok)
52
52
            *conversion_ok = false;
53
 
        return KeeperError(keeper::KeeperError::ERROR_UNKNOWN);
 
53
        return Error(keeper::Error::UNKNOWN);
54
54
    }
55
55
    auto dbus_arg = value.value<QDBusArgument>();
56
56
 
57
57
    if (dbus_arg.currentSignature() != "(i)")
58
58
    {
59
59
        qWarning() << Q_FUNC_INFO
60
 
                   << " Error converting dbus QVariant to KeeperError, expected signature is \"(i)\" and current signature is: \""
 
60
                   << " Error converting dbus QVariant to Error, expected signature is \"(i)\" and current signature is: \""
61
61
                   << dbus_arg.currentSignature() << "\"";
62
62
        if (conversion_ok)
63
63
            *conversion_ok = false;
64
 
        return KeeperError(keeper::KeeperError::ERROR_UNKNOWN);
 
64
        return Error(keeper::Error::UNKNOWN);
65
65
    }
66
 
    KeeperError ret;
 
66
    Error ret;
67
67
    dbus_arg >> ret;
68
68
 
69
69
    if (conversion_ok)