Lomiri Download Manager 0.1.1
A session-wide downloading service
 
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1/*
2 * Copyright 2013-2015 Canonical Ltd.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
19#pragma once
20
21#include <QObject>
22#include <QProcess>
23
24class QDBusError;
25
26namespace Lomiri {
27
28namespace Transfers {
29
30namespace Errors {
31 class AuthErrorStruct;
32 class HttpErrorStruct;
33 class NetworkErrorStruct;
34 class ProcessErrorStruct;
35 class HashErrorStruct;
36}
37
38}
39
40namespace DownloadManager {
41
42class ErrorPrivate;
43
55class Error : public QObject {
56 Q_OBJECT
57 Q_DECLARE_PRIVATE(Error)
58
59 public:
60
72
76 virtual ~Error();
77
83 Type type();
84
90 virtual QString errorString();
91
92 protected:
97 Error(Type type, QObject* parent = 0);
98
99 private:
104 ErrorPrivate* d_ptr;
105
106};
107
108
109class DBusErrorPrivate;
110
117class DBusError : public Error {
118 Q_OBJECT
119 Q_DECLARE_PRIVATE(DBusError)
120
121 friend class ManagerImpl;
122 friend class DownloadImpl;
123 friend class DownloadManagerPCW;
124 friend class DownloadsListManagerPCW;
125 friend class MetadataDownloadsListManagerPCW;
126 friend class DownloadPCW;
127 friend class GroupManagerPCW;
128
132 virtual ~DBusError();
133
139 QString message();
140
146 QString name();
147
153 QString errorString() override;
154
155 protected:
156
162 DBusError(QDBusError err, QObject* parent = 0);
163
164 private:
169 DBusErrorPrivate* d_ptr;
170};
171
172class AuthErrorPrivate;
173
185class AuthError : public Error {
186 Q_OBJECT
187 Q_DECLARE_PRIVATE(AuthError)
188
189 friend class DownloadImpl;
190
191 public:
192
196 enum Type {
198 Proxy
199 };
200
204 virtual ~AuthError();
205
211 Type type();
212
219 QString phrase();
220
226 QString errorString() override;
227
228 protected:
233 AuthError(Transfers::Errors::AuthErrorStruct err, QObject* parent);
234
235 private:
240 AuthErrorPrivate* d_ptr;
241};
242
243class HttpErrorPrivate;
244
254class HttpError : public Error {
255 Q_OBJECT
256 Q_DECLARE_PRIVATE(HttpError)
257
258 friend class DownloadImpl;
259
260 public:
261
265 virtual ~HttpError();
266
272 int code();
273
279 QString phrase();
280
286 QString errorString() override;
287
288 protected:
293 HttpError(Transfers::Errors::HttpErrorStruct err, QObject* parent);
294
295 private:
300 HttpErrorPrivate* d_ptr;
301};
302
303class NetworkErrorPrivate;
304
392
393class ProcessErrorPrivate;
394
401class ProcessError : public Error {
402 Q_OBJECT
403 Q_DECLARE_PRIVATE(ProcessError)
404
405 friend class DownloadImpl;
406
407 public:
408
412 virtual ~ProcessError();
413
419 QProcess::ProcessError code();
420
426 QString phrase();
427
433 int exitCode();
434
440 QString standardOut();
441
447 QString standardError();
448
454 QString errorString() override;
455
456 protected:
457
462 ProcessError(Transfers::Errors::ProcessErrorStruct err, QObject* parent);
463
464 private:
469 ProcessErrorPrivate* d_ptr;
470};
471
472class HashErrorPrivate;
473
480class HashError : public Error {
481 Q_OBJECT
482 Q_DECLARE_PRIVATE(HashError)
483
484 friend class DownloadImpl;
485
486 public:
487
491 virtual ~HashError();
492
498 QString method();
499
506 QString expected();
507
513 QString checksum();
514
520 QString errorString() override;
521
522 protected:
523
528 HashError(Transfers::Errors::HashErrorStruct err, QObject* parent);
529
530 private:
535 HashErrorPrivate* d_ptr;
536};
537
538} // DownloadManager
539
540} // Lomiri
The AuthError represents an authentication error that occurred during the request of the download.
Definition error.h:185
AuthError(Transfers::Errors::AuthErrorStruct err, QObject *parent)
Definition error.cpp:321
QString errorString() override
Definition error.cpp:343
DBusError(QDBusError err, QObject *parent=0)
Definition error.cpp:294
The Error class is the base class that represents an error in the download manager API.
Definition error.h:55
virtual QString errorString()
Definition error.cpp:289
Error(Type type, QObject *parent=0)
Definition error.cpp:273
The HashError represents an error that occurred during the hash validation after the download.
Definition error.h:480
QString errorString() override
Definition error.cpp:477
HashError(Transfers::Errors::HashErrorStruct err, QObject *parent)
Definition error.cpp:449
The HttpError represents an error that occurred during the download request.
Definition error.h:254
QString errorString() override
Definition error.cpp:370
HttpError(Transfers::Errors::HttpErrorStruct err, QObject *parent)
Definition error.cpp:348
The NetworkError represents an error that occurred during the download request.
Definition error.h:311
NetworkError(Transfers::Errors::NetworkErrorStruct err, QObject *parent)
Definition error.cpp:375
The ProcessError represents an error that occurred during the post processing of a downloaded file.
Definition error.h:401
QProcess::ProcessError code()
Definition error.cpp:420
ProcessError(Transfers::Errors::ProcessErrorStruct err, QObject *parent)
Definition error.cpp:403