Skip to content

Commit

Permalink
Clearer error message if file is missing.
Browse files Browse the repository at this point in the history
Triggered by MobileOrg#169
Also added status code. New Dropbox API does not have http status
codes anymore. This could lead to some misbehaviour of state machine.
  • Loading branch information
mgmart committed Feb 3, 2017
1 parent 4ed9bfa commit c7183fa
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Classes/Sync/Dropbox/DropboxTransferManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,23 @@ import SwiftyDropbox
self.requestFinished(self.activeTransfer!)
}
if let error = error {
self.activeTransfer?.errorText = error.description
switch error as CallError {
case .routeError(let boxed, let requestId):
switch boxed.unboxed as Files.DownloadError {
case .path(let lookupError):
switch lookupError {
case .notFound:
self.activeTransfer?.statusCode = 404
self.activeTransfer?.errorText = "The file \(self.activeTransfer?.remoteUrl.lastPathComponent) could not be found"
default:
self.activeTransfer?.errorText = error.description
}
default:
self.activeTransfer?.errorText = error.description
}
default:
self.activeTransfer?.errorText = error.description
}
self.activeTransfer?.success = false
self.requestFinished(self.activeTransfer!)
}
Expand Down

0 comments on commit c7183fa

Please sign in to comment.