| 1 | /* |
| 2 | knewstuff3/errorcode.h. |
| 3 | SPDX-FileCopyrightText: 2018 Dan Leinir Turthra Jensen <admin@leinir.dk> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KNSCORE_ERRORCODE_H |
| 9 | #define KNSCORE_ERRORCODE_H |
| 10 | |
| 11 | #include "knewstuffcore_export.h" |
| 12 | #include <qobjectdefs.h> |
| 13 | |
| 14 | /*! |
| 15 | * \namespace KNSCore::ErrorCode |
| 16 | * \inmodule KNewStuffCore |
| 17 | */ |
| 18 | namespace KNSCore::ErrorCode |
| 19 | { |
| 20 | Q_NAMESPACE_EXPORT(KNEWSTUFFCORE_EXPORT) |
| 21 | /** |
| 22 | * \enum KNSCore::ErrorCode::ErrorCode |
| 23 | * |
| 24 | * \brief An enumeration of specific error conditions which might occur and which |
| 25 | * users of KNewStuff would want to react to. It is used by both the Engine and |
| 26 | * Provider classes. |
| 27 | * |
| 28 | * \since 5.53 |
| 29 | * TODO: KF6 do not repeat entry properties in the QVariantList |
| 30 | |
| 31 | * \value UnknownError |
| 32 | * An unknown error (this should not be used, an error report of this nature should be considered a bug) |
| 33 | * |
| 34 | * \value NetworkError |
| 35 | * A network error. In signalErrorCode, this will be accompanied by the |
| 36 | * QtNetwork error code in the metadata |
| 37 | * |
| 38 | * \value OcsError |
| 39 | * An error reported by the OCS API server. In signalErrorCode, this will be |
| 40 | * accompanied by the OCS error code in the metadata |
| 41 | * |
| 42 | * \value ConfigFileError |
| 43 | * The configuration file is missing or somehow incorrect. The configuration |
| 44 | * file filename will be held in the metadata |
| 45 | * |
| 46 | * \value ProviderError |
| 47 | * A provider has failed to load or initialize. The provider file URL or |
| 48 | * provider URL will be held in the metadata |
| 49 | * |
| 50 | * \value InstallationError |
| 51 | * Installation of a content item has failed. If known, the entry's unique ID |
| 52 | * will be the metadata |
| 53 | * |
| 54 | * \value ImageError |
| 55 | * Loading an image has failed. The entry name and preview type which failed |
| 56 | * will be held in the metadata as a QVariantList |
| 57 | * |
| 58 | * \value AdoptionError |
| 59 | * Adopting one entry has failed. The adoption command will be in the metadata |
| 60 | * as a QVariantList. |
| 61 | * |
| 62 | * \value TryAgainLaterError |
| 63 | * Specific error condition for failed network calls which explicitly request |
| 64 | * an amount of time to wait before retrying (generally interpreted as |
| 65 | * maintenance). The retry will be scheduled automatically, and this code can |
| 66 | * be used to show the user how long they have to wait. The time after which |
| 67 | * the user can try again can be read as a QDateTime in the metadata. \since 5.84 |
| 68 | */ |
| 69 | enum ErrorCode { |
| 70 | UnknownError, |
| 71 | NetworkError, |
| 72 | OcsError, |
| 73 | ConfigFileError, |
| 74 | ProviderError, |
| 75 | InstallationError, |
| 76 | ImageError, |
| 77 | AdoptionError, |
| 78 | TryAgainLaterError, |
| 79 | }; |
| 80 | Q_ENUM_NS(ErrorCode) |
| 81 | } |
| 82 | #endif // KNSCORE_ERRORCODE_H |
| 83 | |