1/*
2 SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KDAV_DAVERROR_H
8#define KDAV_DAVERROR_H
9
10#include "kdav_export.h"
11
12#include <KJob>
13
14#include <QSharedDataPointer>
15#include <QString>
16
17namespace KDAV
18{
19/** DAV operation error codes. */
20enum ErrorNumber {
21 NO_ERR = 0,
22 ERR_PROBLEM_WITH_REQUEST = KJob::UserDefinedError + 200, // it would be better to request KIO about uts UserDefinedError space.
23 ERR_NO_MULTIGET,
24 ERR_SERVER_UNRECOVERABLE,
25 ERR_COLLECTIONDELETE = ERR_PROBLEM_WITH_REQUEST + 10,
26 ERR_COLLECTIONFETCH = ERR_PROBLEM_WITH_REQUEST + 20,
27 ERR_COLLECTIONFETCH_XQUERY_SETFOCUS,
28 ERR_COLLECTIONFETCH_XQUERY_INVALID,
29 ERR_COLLECTIONMODIFY = ERR_PROBLEM_WITH_REQUEST + 30,
30 ERR_COLLECTIONMODIFY_NO_PROPERITES,
31 ERR_COLLECTIONMODIFY_RESPONSE,
32 ERR_ITEMCREATE = ERR_PROBLEM_WITH_REQUEST + 100,
33 ERR_ITEMDELETE = ERR_PROBLEM_WITH_REQUEST + 110,
34 ERR_ITEMMODIFY = ERR_PROBLEM_WITH_REQUEST + 120,
35 ERR_ITEMLIST = ERR_PROBLEM_WITH_REQUEST + 130,
36 ERR_ITEMLIST_NOMIMETYPE,
37};
38
39class ErrorPrivate;
40
41/**
42 * @class Error daverror.h <KDAV/DavError>
43 *
44 * DAV operation error.
45 */
46class KDAV_EXPORT Error
47{
48public:
49 explicit Error();
50 explicit Error(ErrorNumber errNo, int responseCode, const QString &errorText, int jobErrorCode);
51 Error(const Error &);
52 Error(Error &&);
53 ~Error();
54 Error &operator=(const Error &);
55 Error &operator=(Error &&);
56
57 Q_REQUIRED_RESULT ErrorNumber errorNumber() const;
58 Q_REQUIRED_RESULT int responseCode() const;
59 Q_REQUIRED_RESULT QString internalErrorText() const;
60 Q_REQUIRED_RESULT int jobErrorCode() const;
61 Q_REQUIRED_RESULT QString translatedJobError() const;
62 Q_REQUIRED_RESULT QString errorText() const;
63
64private:
65 QSharedDataPointer<ErrorPrivate> d;
66};
67}
68
69#endif
70

source code of kdav/src/common/daverror.h