TerraSync: better reporting of permissions failures removing files
Log a ‘failed to remove orphan’ error as an error with the repository, instead of failing the entire sync
This commit is contained in:
parent
ae920c6ebd
commit
5f026c840c
@ -393,7 +393,12 @@ public:
|
|||||||
|
|
||||||
// We now have a list of entries that need to be updated, and a list
|
// We now have a list of entries that need to be updated, and a list
|
||||||
// of orphan files that should be removed.
|
// of orphan files that should be removed.
|
||||||
|
try {
|
||||||
removeOrphans(orphans);
|
removeOrphans(orphans);
|
||||||
|
} catch (sg_exception& e) {
|
||||||
|
_repository->failedToUpdateChild(_relativePath, HTTPRepository::ResultCode::REPO_ERROR_IO);
|
||||||
|
}
|
||||||
|
|
||||||
scheduleUpdates(toBeUpdated);
|
scheduleUpdates(toBeUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,11 +410,10 @@ public:
|
|||||||
|
|
||||||
void removeOrphans(const PathList orphans)
|
void removeOrphans(const PathList orphans)
|
||||||
{
|
{
|
||||||
PathList::const_iterator it;
|
for (const auto& o : orphans) {
|
||||||
for (it = orphans.begin(); it != orphans.end(); ++it) {
|
if (o.file() == ".dirindex") continue;
|
||||||
if (it->file() == ".dirindex") continue;
|
if (o.file() == ".hash") continue;
|
||||||
if (it->file() == ".hash") continue;
|
removeChild(o);
|
||||||
removeChild(*it);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,7 +775,7 @@ private:
|
|||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
SG_LOG(SG_TERRASYNC, SG_WARN, "removal failed for:" << path);
|
SG_LOG(SG_TERRASYNC, SG_WARN, "removal failed for:" << path);
|
||||||
throw sg_io_exception("Failed to remove existing file/dir:", path);
|
throw sg_io_exception("Failed to remove existing file/dir:", path, _repository->basePath.utf8Str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user