Ubuntu Download Manager: /build/ubuntu-download-manager-git/src/ubuntu-download-manager/src/downloads/client/ubuntu/download_manager/error.h Source File

Ubuntu Download Manager 1.2.0 A session-wide downloading service |

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
24 class QDBusError;
25
26 namespace Ubuntu {
27
28 namespace Transfers {
29
30 namespace Errors {
31 class AuthErrorStruct;
32 class HttpErrorStruct;
33 class NetworkErrorStruct;
34 class ProcessErrorStruct;
35 class HashErrorStruct;
36 }
37
38 }
39
40 namespace DownloadManager {
41
42 class ErrorPrivate;
43
55 class Error : public QObject {
56 Q_OBJECT
57 Q_DECLARE_PRIVATE(Error)
58
59 public:
60
64 enum Type {
65 Auth,
66 DBus,
67 Http,
68 Network,
69 Process,
70 Hash
71 };
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
109 class DBusErrorPrivate;
110
117 class 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
172 class AuthErrorPrivate;
173
185 class AuthError : public Error {
186 Q_OBJECT
187 Q_DECLARE_PRIVATE(AuthError)
188
189 friend class DownloadImpl;
190
191 public:
192
196 enum Type {
197 Server,
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
243 class HttpErrorPrivate;
244
254 class 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
303 class NetworkErrorPrivate;
304
311 class NetworkError : public Error {
312 Q_OBJECT
313 Q_DECLARE_PRIVATE(NetworkError)
314
315 friend class DownloadImpl;
316
317 public:
318
323 enum ErrorCode {
324 ConnectionRefusedError,
325 RemoteHostClosedError,
326 HostNotFoundError,
327 TimeoutError,
328 OperationCanceledError,
329 SslHandshakeFailedError,
330 TemporaryNetworkFailureError,
331 NetworkSessionFailedError,
332 BackgroundRequestNotAllowedError,
333 ProxyConnectionRefusedError,
334 ProxyConnectionClosedError,
335 ProxyNotFoundError,
336 ProxyTimeoutError,
337 ProxyAuthenticationRequiredError,
338 ContentAccessDenied,
339 ContentOperationNotPermittedError,
340 ContentNotFoundError,
341 AuthenticationRequiredError,
342 ContentReSendError,
343 ProtocolUnknownError,
344 ProtocolInvalidOperationError,
345 UnknownNetworkError,
346 UnknownProxyError,
347 UnknownContentError,
348 ProtocolFailure
349 };
350
354 virtual ~NetworkError();
355
361 ErrorCode code();
362
368 QString phrase();
369
375 QString errorString() override;
376
377 protected:
378
383 NetworkError(Transfers::Errors::NetworkErrorStruct err, QObject* parent);
384
385 private:
390 NetworkErrorPrivate* d_ptr;
391 };
392
393 class ProcessErrorPrivate;
394
401 class 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
472 class HashErrorPrivate;
473
480 class 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 } // Ubuntu
Ubuntu::DownloadManager::ProcessError::errorString
QString errorString() override
Definition: error.cpp:444
QObject
Ubuntu::DownloadManager::Error::DBus
@ DBus
Definition: error.h:66
Ubuntu::DownloadManager::Error::Type
Type
Definition: error.h:64
Ubuntu::DownloadManager::NetworkError::errorString
QString errorString() override
Definition: error.cpp:398
Ubuntu::DownloadManager::HttpError::~HttpError
virtual ~HttpError()
Definition: error.cpp:353
Ubuntu::DownloadManager::NetworkError::ProtocolFailure
@ ProtocolFailure
Definition: error.h:348
Ubuntu::DownloadManager::NetworkError::ContentOperationNotPermittedError
@ ContentOperationNotPermittedError
Definition: error.h:339
Ubuntu::DownloadManager::NetworkError::ProxyTimeoutError
@ ProxyTimeoutError
Definition: error.h:336
Ubuntu::DownloadManager::ProcessError::code
QProcess::ProcessError code()
Definition: error.cpp:420
Ubuntu::DownloadManager::NetworkError::TimeoutError
@ TimeoutError
Definition: error.h:327
Ubuntu
Definition: download.h:26
Ubuntu::DownloadManager::NetworkError::TemporaryNetworkFailureError
@ TemporaryNetworkFailureError
Definition: error.h:330
Ubuntu::DownloadManager::NetworkError::OperationCanceledError
@ OperationCanceledError
Definition: error.h:328
Ubuntu::DownloadManager::NetworkError::ErrorCode
ErrorCode
Definition: error.h:323
Ubuntu::DownloadManager::NetworkError::AuthenticationRequiredError
@ AuthenticationRequiredError
Definition: error.h:341
Ubuntu::DownloadManager::HashError::HashError
HashError(Transfers::Errors::HashErrorStruct err, QObject *parent)
Definition: error.cpp:449
Ubuntu::DownloadManager::ProcessError::ProcessError
ProcessError(Transfers::Errors::ProcessErrorStruct err, QObject *parent)
Definition: error.cpp:403
Ubuntu::DownloadManager::AuthError::phrase
QString phrase()
Definition: error.cpp:337
Ubuntu::DownloadManager::HashError::~HashError
virtual ~HashError()
Definition: error.cpp:454
Ubuntu::DownloadManager::NetworkError::NetworkError
NetworkError(Transfers::Errors::NetworkErrorStruct err, QObject *parent)
Definition: error.cpp:375
Ubuntu::DownloadManager::NetworkError::NetworkSessionFailedError
@ NetworkSessionFailedError
Definition: error.h:331
Ubuntu::DownloadManager::HashError
The HashError represents an error that occurred during the hash validation after the download.
Definition: error.h:480
Ubuntu::DownloadManager::NetworkError::UnknownNetworkError
@ UnknownNetworkError
Definition: error.h:345
Ubuntu::DownloadManager::Error::Error
Error(Type type, QObject *parent=0)
Definition: error.cpp:273
Ubuntu::DownloadManager::ProcessError::exitCode
int exitCode()
Definition: error.cpp:426
Ubuntu::DownloadManager::HashError::method
QString method()
Definition: error.cpp:459
Ubuntu::DownloadManager::AuthError::~AuthError
virtual ~AuthError()
Definition: error.cpp:326
Ubuntu::DownloadManager::NetworkError::UnknownProxyError
@ UnknownProxyError
Definition: error.h:346
Ubuntu::DownloadManager::NetworkError::ProxyConnectionClosedError
@ ProxyConnectionClosedError
Definition: error.h:334
Ubuntu::DownloadManager::HashError::checksum
QString checksum()
Definition: error.cpp:471
Ubuntu::DownloadManager::NetworkError::ProtocolUnknownError
@ ProtocolUnknownError
Definition: error.h:343
Ubuntu::DownloadManager::NetworkError::ContentNotFoundError
@ ContentNotFoundError
Definition: error.h:340
Ubuntu::DownloadManager::AuthError::AuthError
AuthError(Transfers::Errors::AuthErrorStruct err, QObject *parent)
Definition: error.cpp:321
Ubuntu::DownloadManager::AuthError::type
Type type()
Definition: error.cpp:331
Ubuntu::DownloadManager::Error::Network
@ Network
Definition: error.h:68
Ubuntu::DownloadManager::NetworkError::ConnectionRefusedError
@ ConnectionRefusedError
Definition: error.h:324
Ubuntu::DownloadManager::HashError::expected
QString expected()
Definition: error.cpp:465
Ubuntu::DownloadManager::NetworkError::ProxyAuthenticationRequiredError
@ ProxyAuthenticationRequiredError
Definition: error.h:337
Ubuntu::DownloadManager::NetworkError::phrase
QString phrase()
Definition: error.cpp:392
Ubuntu::DownloadManager::Error::type
Type type()
Definition: error.cpp:283
Ubuntu::DownloadManager::ProcessError::~ProcessError
virtual ~ProcessError()
Definition: error.cpp:409
Ubuntu::DownloadManager::NetworkError::ProxyNotFoundError
@ ProxyNotFoundError
Definition: error.h:335
Ubuntu::DownloadManager::NetworkError::BackgroundRequestNotAllowedError
@ BackgroundRequestNotAllowedError
Definition: error.h:332
Ubuntu::DownloadManager::HttpError
The HttpError represents an error that occurred during the download request.
Definition: error.h:254
Ubuntu::DownloadManager::ProcessError
The ProcessError represents an error that occurred during the post processing of a downloaded file.
Definition: error.h:401
Ubuntu::DownloadManager::Error::Http
@ Http
Definition: error.h:67
Ubuntu::DownloadManager::NetworkError
The NetworkError represents an error that occurred during the download request.
Definition: error.h:311
Ubuntu::DownloadManager::AuthError::Server
@ Server
Definition: error.h:197
Ubuntu::DownloadManager::NetworkError::UnknownContentError
@ UnknownContentError
Definition: error.h:347
Ubuntu::DownloadManager::ProcessError::standardError
QString standardError()
Definition: error.cpp:438
Ubuntu::DownloadManager::NetworkError::ProtocolInvalidOperationError
@ ProtocolInvalidOperationError
Definition: error.h:344
Ubuntu::DownloadManager::NetworkError::ContentReSendError
@ ContentReSendError
Definition: error.h:342
Ubuntu::DownloadManager::Error::Hash
@ Hash
Definition: error.h:70
Ubuntu::DownloadManager::NetworkError::RemoteHostClosedError
@ RemoteHostClosedError
Definition: error.h:325
Ubuntu::DownloadManager::NetworkError::code
ErrorCode code()
Definition: error.cpp:386
Ubuntu::DownloadManager::AuthError::Type
Type
Definition: error.h:196
Ubuntu::DownloadManager::Error
The Error class is the base class that represents an error in the download manager API.
Definition: error.h:55
Ubuntu::DownloadManager::Error::Process
@ Process
Definition: error.h:69
Ubuntu::DownloadManager::NetworkError::HostNotFoundError
@ HostNotFoundError
Definition: error.h:326
Ubuntu::DownloadManager::DBusError
Definition: error.h:117
Ubuntu::DownloadManager::HttpError::errorString
QString errorString() override
Definition: error.cpp:370
Ubuntu::DownloadManager::NetworkError::SslHandshakeFailedError
@ SslHandshakeFailedError
Definition: error.h:329
Ubuntu::DownloadManager::AuthError
The AuthError represents an authentication error that occurred during the request of the download.
Definition: error.h:185
Ubuntu::DownloadManager::ProcessError::phrase
QString phrase()
Definition: error.cpp:414
Ubuntu::DownloadManager::Error::errorString
virtual QString errorString()
Definition: error.cpp:289
Ubuntu::DownloadManager::NetworkError::~NetworkError
virtual ~NetworkError()
Definition: error.cpp:381
Ubuntu::DownloadManager::NetworkError::ProxyConnectionRefusedError
@ ProxyConnectionRefusedError
Definition: error.h:333
Ubuntu::DownloadManager::AuthError::errorString
QString errorString() override
Definition: error.cpp:343
Ubuntu::DownloadManager::HttpError::code
int code()
Definition: error.cpp:358
Ubuntu::DownloadManager::Error::~Error
virtual ~Error()
Definition: error.cpp:278
Ubuntu::DownloadManager::HttpError::HttpError
HttpError(Transfers::Errors::HttpErrorStruct err, QObject *parent)
Definition: error.cpp:348
Ubuntu::DownloadManager::Error::Auth
@ Auth
Definition: error.h:65
Ubuntu::DownloadManager::HashError::errorString
QString errorString() override
Definition: error.cpp:477
Ubuntu::DownloadManager::AuthError::Proxy
@ Proxy
Definition: error.h:198
Ubuntu::DownloadManager::DBusError::DBusError
DBusError(QDBusError err, QObject *parent=0)
Definition: error.cpp:294
Ubuntu::DownloadManager::ProcessError::standardOut
QString standardOut()
Definition: error.cpp:432
Ubuntu::DownloadManager::HttpError::phrase
QString phrase()
Definition: error.cpp:364
Ubuntu::DownloadManager::NetworkError::ContentAccessDenied
@ ContentAccessDenied
Definition: error.h:338