Make DetailError different from BlacklistedError

It's quite different in regard to blacklist handling and overall
sync failure changes.
This commit is contained in:
Christian Kamm 2017-07-12 12:38:53 +02:00 committed by ckamm
parent 709aa27031
commit 0c99673581
7 changed files with 29 additions and 17 deletions

View file

@ -147,6 +147,7 @@ QTreeWidgetItem *ProtocolWidget::createCompletedTreewidgetItem(const QString &fo
QIcon icon;
if (item._status == SyncFileItem::NormalError
|| item._status == SyncFileItem::FatalError
|| item._status == SyncFileItem::DetailError
|| item._status == SyncFileItem::BlacklistedError) {
icon = Theme::instance()->syncStateIcon(SyncResult::Error);
} else if (Progress::isWarningKind(item._status)) {

View file

@ -172,7 +172,8 @@ static void blacklistUpdate(SyncJournalDb *journal, SyncFileItem &item)
bool mayBlacklist =
item._errorMayBeBlacklisted // explicitly flagged for blacklisting
|| ((item._status == SyncFileItem::NormalError
|| item._status == SyncFileItem::SoftError)
|| item._status == SyncFileItem::SoftError
|| item._status == SyncFileItem::DetailError)
&& item._httpErrorCode != 0 // or non-local error
);
@ -239,13 +240,9 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
case SyncFileItem::SoftError:
case SyncFileItem::FatalError:
case SyncFileItem::NormalError:
case SyncFileItem::BlacklistedError:
case SyncFileItem::DetailError:
// Check the blacklist, possibly adjusting the item (including its status)
// but not if this status comes from blacklisting in the first place
if (!(_item->_status == SyncFileItem::BlacklistedError
&& _item->_instruction == CSYNC_INSTRUCTION_IGNORE)) {
blacklistUpdate(propagator()->_journal, *_item);
}
blacklistUpdate(propagator()->_journal, *_item);
break;
case SyncFileItem::Success:
case SyncFileItem::Restoration:
@ -261,6 +258,7 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
case SyncFileItem::Conflict:
case SyncFileItem::FileIgnored:
case SyncFileItem::NoStatus:
case SyncFileItem::BlacklistedError:
// nothing
break;
}
@ -805,7 +803,8 @@ void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
if (status == SyncFileItem::FatalError
|| status == SyncFileItem::NormalError
|| status == SyncFileItem::SoftError) {
|| status == SyncFileItem::SoftError
|| status == SyncFileItem::DetailError) {
_hasError = status;
}

View file

@ -91,7 +91,7 @@ bool Progress::isWarningKind(SyncFileItem::Status kind)
return kind == SyncFileItem::SoftError || kind == SyncFileItem::NormalError
|| kind == SyncFileItem::FatalError || kind == SyncFileItem::FileIgnored
|| kind == SyncFileItem::Conflict || kind == SyncFileItem::Restoration
|| kind == SyncFileItem::BlacklistedError;
|| kind == SyncFileItem::DetailError || kind == SyncFileItem::BlacklistedError;
}
bool Progress::isIgnoredKind(SyncFileItem::Status kind)

View file

@ -429,10 +429,10 @@ void PropagateDownloadFile::startDownload()
const auto diskSpaceResult = propagator()->diskSpaceCheck();
if (diskSpaceResult != OwncloudPropagator::DiskSpaceOk) {
if (diskSpaceResult == OwncloudPropagator::DiskSpaceFailure) {
// Using BlacklistedError here will make the error not pop up in the account
// Using DetailError here will make the error not pop up in the account
// tab: instead we'll generate a general "disk space low" message and show
// these detail errors only in the error view.
done(SyncFileItem::BlacklistedError,
done(SyncFileItem::DetailError,
tr("The download would reduce free local disk space below the limit"));
emit propagator()->insufficientLocalStorage();
} else if (diskSpaceResult == OwncloudPropagator::DiskSpaceCritical) {

View file

@ -524,8 +524,7 @@ void PropagateUploadFileCommon::commonErrorHandling(AbstractNetworkJob *job)
if (_item->_httpErrorCode == 507) {
// Insufficient remote storage.
_item->_errorMayBeBlacklisted = true;
status = SyncFileItem::BlacklistedError;
status = SyncFileItem::DetailError;
errorString = tr("Upload of %1 exceeds the quota for the folder").arg(Utility::octetsToString(_item->_size));
emit propagator()->insufficientRemoteStorage();
}

View file

@ -64,12 +64,24 @@ public:
FileIgnored, ///< The file is in the ignored list (or blacklisted with no retries left)
Restoration, ///< The file was restored because what should have been done was not allowed
/** For files whose errors were blacklisted.
/** For errors that should only appear in the error view.
*
* If _instruction == IGNORE, the file wasn't even reattempted.
* Some errors also produce a summary message. Usually displaying that message is
* sufficient, but the individual errors should still appear in the issues tab.
*
* These errors should usually be shown as NormalErrors, but not be as loud
* as them.
* These errors do cause the sync to fail.
*
* A NormalError that isn't as prominent.
*/
DetailError,
/** For files whose errors were blacklisted
*
* If an file is blacklisted due to an error it isn't even reattempted. These
* errors should appear in the issues tab, but not on the account settings and
* should not cause the sync run to fail.
*
* A DetailError that doesn't cause sync failure.
*/
BlacklistedError
};

View file

@ -94,6 +94,7 @@ static inline bool showErrorInSocketApi(const SyncFileItem &item)
return item._instruction == CSYNC_INSTRUCTION_ERROR
|| status == SyncFileItem::NormalError
|| status == SyncFileItem::FatalError
|| status == SyncFileItem::DetailError
|| status == SyncFileItem::BlacklistedError
|| item._hasBlacklistEntry;
}