Skip to content

Build .noSuchItem and .filenameCollision errors correctly#70

Merged
claucambra merged 19 commits into
mainfrom
bugfix/errors-building
May 9, 2025
Merged

Build .noSuchItem and .filenameCollision errors correctly#70
claucambra merged 19 commits into
mainfrom
bugfix/errors-building

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

No description provided.

claucambra added 19 commits May 7, 2025 13:47
…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>
@claucambra claucambra added this to the 2.1 milestone May 7, 2025
@claucambra claucambra requested a review from Copilot May 7, 2025 07:54
@claucambra claucambra self-assigned this May 7, 2025
@claucambra claucambra added the bug Something isn't working label May 7, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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? {

Comment thread Sources/NextcloudFileProviderKit/Utilities/ThumbnailFetching.swift
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 4.09091% with 211 lines in your changes missing coverage. Please review.

Project coverage is 81.02%. Comparing base (41c1a7f) to head (7b801bd).
Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
...es/NextcloudFileProviderKit/Item/Item+Create.swift 4.76% 60 Missing ⚠️
...es/NextcloudFileProviderKit/Item/Item+Modify.swift 0.00% 59 Missing ⚠️
...ces/NextcloudFileProviderKit/Item/Item+Fetch.swift 3.22% 30 Missing ⚠️
...tcloudFileProviderKit/Enumeration/Enumerator.swift 7.14% 26 Missing ⚠️
...ileProviderKit/Extensions/NKError+Extensions.swift 0.00% 24 Missing ⚠️
...dFileProviderKit/Utilities/ThumbnailFetching.swift 0.00% 5 Missing ⚠️
...es/NextcloudFileProviderKit/Item/Item+Delete.swift 0.00% 4 Missing ⚠️
...loudFileProviderKit/Item/Item+DeleteLockFile.swift 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@claucambra claucambra merged commit 52e92f5 into main May 9, 2025
1 of 3 checks passed
@Rello Rello deleted the bugfix/errors-building branch August 15, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants