Build .noSuchItem and .filenameCollision errors correctly#70
Conversation
…le contents Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…hItem Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…e/modify Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
There was a problem hiding this comment.
Pull Request Overview
This PR revises error‐handling throughout the codebase so that .noSuchItem and .filenameCollision errors are built consistently via new helper methods (primarily using NSError.fileProviderErrorForNonExistentItem and error.fileProviderError(…)). Key changes include:
- Replacing direct NSFileProviderError constructions with calls to NSError helper functions.
- Updating the error conversion paths in modify, fetch, delete, create, and enumeration workflows.
- Adjusting inline comments and logging to align with the new error‐handling approach.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Sources/NextcloudFileProviderKit/Utilities/ThumbnailFetching.swift | Update error creation for thumbnail download failures. |
| Sources/NextcloudFileProviderKit/Item/Item+Modify.swift | Replace NSFileProviderError(.noSuchItem) with NSError conversions. |
| Sources/NextcloudFileProviderKit/Item/Item+Fetch.swift | Update error handling for failed fetch operations. |
| Sources/NextcloudFileProviderKit/Item/Item+Delete*.swift | Adjust error handling in delete and lock file deletion operations. |
| Sources/NextcloudFileProviderKit/Item/Item+Create*.swift | Use new collision and non-existent item error helper methods. |
| Sources/NextcloudFileProviderKit/Extensions/NKError+Extensions.swift | Enhance error conversion methods for collision errors. |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift | Update enumeration error handling to use new NSError conversions. |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Add account property for improved error context. |
| README.md | Update sample error responses to reflect changes in error conversion. |
Comments suppressed due to low confidence (2)
Sources/NextcloudFileProviderKit/Item/Item+Modify.swift:80
- [nitpick] Consider adding a brief inline comment explaining why the new error conversion is preferred over NSFileProviderError(.noSuchItem) here to aid future maintainability and clarity.
return (nil, NSError.fileProviderErrorForNonExistentItem(withIdentifier: self.itemIdentifier))
Sources/NextcloudFileProviderKit/Extensions/NKError+Extensions.swift:82
- [nitpick] Review that the fallback to NSFileProviderError(.filenameCollision) in the collision handling method meets all expected error condition scenarios; ensuring that the error messages and codes remain consistent across different parts of the app.
func fileProviderError( handlingCollisionAgainstItemInRemotePath problemRemotePath: String, dbManager: FilesDatabaseManager, remoteInterface: RemoteInterface ) -> Error? {
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
==========================================
- Coverage 81.60% 81.02% -0.58%
==========================================
Files 62 62
Lines 12882 12979 +97
==========================================
+ Hits 10512 10516 +4
- Misses 2370 2463 +93 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.