Add no changes error code in NKError extension

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-03-13 14:38:21 +01:00
parent a0c819fdbe
commit d639baeea0
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -17,6 +17,12 @@ import FileProvider
import NextcloudKit
extension NKError {
static var noChangesErrorCode: Int {
get {
return -200
}
}
var isCouldntConnectError: Bool {
get {
let nkErrorCode = self.errorCode
@ -52,6 +58,12 @@ extension NKError {
}
}
var isNoChangesError: Bool {
get {
return self.errorCode == NKError.noChangesErrorCode
}
}
func toFileProviderError() -> NSFileProviderError {
if self.isNotFoundError {
return NSFileProviderError(.noSuchItem)