Libkdav2

daverror.h
1 /*
2  Copyright (c) 2016 Sandro KnauƟ <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef KDAV2_DAVERROR_H
20 #define KDAV2_DAVERROR_H
21 
22 #include "kpimkdav2_export.h"
23 
24 #include <KJob>
25 
26 #include <QString>
27 
28 namespace KDAV2
29 {
30 
31 enum ErrorNumber {
32  NO_ERR = 0,
33  ERR_PROBLEM_WITH_REQUEST = KJob::UserDefinedError + 200,
34  ERR_NO_MULTIGET,
35  ERR_SERVER_UNRECOVERABLE,
36  ERR_COLLECTIONDELETE = ERR_PROBLEM_WITH_REQUEST + 10,
37  ERR_COLLECTIONFETCH = ERR_PROBLEM_WITH_REQUEST + 20,
38  ERR_COLLECTIONFETCH_XQUERY_SETFOCUS,
39  ERR_COLLECTIONFETCH_XQUERY_INVALID,
40  ERR_COLLECTIONMODIFY = ERR_PROBLEM_WITH_REQUEST + 30,
41  ERR_COLLECTIONMODIFY_NO_PROPERITES,
42  ERR_COLLECTIONMODIFY_RESPONSE,
43  ERR_COLLECTIONCREATE = ERR_PROBLEM_WITH_REQUEST + 40,
44  ERR_ITEMCREATE = ERR_PROBLEM_WITH_REQUEST + 100,
45  ERR_ITEMDELETE = ERR_PROBLEM_WITH_REQUEST + 110,
46  ERR_ITEMMODIFY = ERR_PROBLEM_WITH_REQUEST + 120,
47  ERR_ITEMLIST = ERR_PROBLEM_WITH_REQUEST + 130,
48  ERR_ITEMLIST_NOMIMETYPE
49 };
50 
51 class KPIMKDAV2_EXPORT Error {
52 public:
53  explicit Error();
54  explicit Error(ErrorNumber errNo, int httpStatusCode, int responseCode, const QString &errorText, int jobErrorCode);
55 
56  /**
57  * Error number
58  */
59  ErrorNumber errorNumber() const;
60 
61  /**
62  * Latest HTTP status code
63  */
64  int httpStatusCode() const;
65 
66  /**
67  * Latest QNetworkReply::NetworkError.
68  */
69  int responseCode() const;
70 
71  /**
72  * Error text of the subjob that failed.
73  */
74  QString errorText() const;
75 
76  /**
77  * Error code of the subjob that failed.
78  */
79  int jobErrorCode() const;
80 
81  /**
82  * Generate an error description.
83  */
84  QString description() const;
85 
86 private:
87  ErrorNumber mErrorNumber;
88  int mHttpStatusCode;
89  int mResponseCode;
90  QString mErrorText;
91  int mJobErrorCode;
92 };
93 
94 }
95 
96 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 23:10:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.