Skip to content

Commit 7b801bd

Browse files
committed
Update README with correct error construction
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
1 parent ee1641d commit 7b801bd

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ func item(
5252
if let item = Item.storedItem(identifier: identifier, remoteInterface: ncKit) {
5353
completionHandler(item, nil)
5454
} else {
55-
completionHandler(nil, NSFileProviderError(.noSuchItem))
55+
completionHandler(
56+
nil, NSError.fileProviderErrorForNonExistentItem(withIdentifier: identifier)
57+
)
5658
}
5759
return Progress()
5860
}
@@ -77,7 +79,9 @@ func fetchContents(
7779
}
7880

7981
guard let item = Item.storedItem(identifier: itemIdentifier, remoteInterface: ncKit) else {
80-
completionHandler(nil, nil, NSFileProviderError(.noSuchItem))
82+
completionHandler(
83+
nil, nil, NSError.fileProviderErrorForNonExistentItem(withIdentifier: itemIdentifier)
84+
)
8185
return Progress()
8286
}
8387

@@ -131,7 +135,12 @@ func modifyItem(
131135
completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, Error?) -> Void
132136
) -> Progress {
133137
guard let existingItem = Item.storedItem(identifier: item.itemIdentifier, remoteInterface: ncKit) else {
134-
completionHandler(item, [], false, NSFileProviderError(.noSuchItem))
138+
completionHandler(
139+
item,
140+
[],
141+
false,
142+
NSError.fileProviderErrorForNonExistentItem(withIdentifier: item.itemIdentifier)
143+
)
135144
return Progress()
136145
}
137146

@@ -164,7 +173,7 @@ func deleteItem(
164173
completionHandler: @escaping (Error?) -> Void
165174
) -> Progress {
166175
guard let item = Item.storedItem(identifier: identifier, remoteInterface: ncKit) else {
167-
completionHandler(NSFileProviderError(.noSuchItem))
176+
completionHandler(NSError.fileProviderErrorForNonExistentItem(withIdentifier: identifier))
168177
return Progress()
169178
}
170179

0 commit comments

Comments
 (0)