mirror of https://github.com/nextcloud/desktop
Improve logging across file provider sharing
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
a899fe19fa
commit
ac1b11708f
|
@ -34,7 +34,7 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
|
|||
override func prepare(
|
||||
forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]
|
||||
) {
|
||||
Logger.actionViewController.info("Preparing for action: \(actionIdentifier)")
|
||||
Logger.actionViewController.info("Preparing action: \(actionIdentifier, privacy: .public)")
|
||||
|
||||
if actionIdentifier == "com.nextcloud.desktopclient.FileProviderUIExt.ShareAction" {
|
||||
prepare(childViewController: ShareViewController(itemIdentifiers))
|
||||
|
@ -43,7 +43,11 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
|
|||
}
|
||||
|
||||
override func prepare(forError error: Error) {
|
||||
Logger.actionViewController.info("Preparing for error: \(error.localizedDescription)")
|
||||
Logger.actionViewController.info(
|
||||
"""
|
||||
Preparing for error: \(error.localizedDescription, privacy: .public)
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
override public func loadView() {
|
||||
|
|
|
@ -42,14 +42,18 @@ class ShareController: ObservableObject {
|
|||
) { account, share, data, error in
|
||||
defer { continuation.resume(returning: error) }
|
||||
guard error == .success else {
|
||||
Logger.shareController.error("Error creating link share: \(error)")
|
||||
Logger.shareController.error(
|
||||
"""
|
||||
Error creating link share: \(error.errorDescription, privacy: .public)
|
||||
"""
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
guard let shareWith = shareWith else {
|
||||
let errorString = "No recipient for share!"
|
||||
Logger.shareController.error("\(errorString)")
|
||||
Logger.shareController.error("\(errorString, privacy: .public)")
|
||||
let error = NKError(statusCode: 0, fallbackDescription: errorString)
|
||||
continuation.resume(returning: error)
|
||||
return
|
||||
|
@ -66,7 +70,11 @@ class ShareController: ObservableObject {
|
|||
) { account, share, data, error in
|
||||
defer { continuation.resume(returning: error) }
|
||||
guard error == .success else {
|
||||
Logger.shareController.error("Error creating share: \(error)")
|
||||
Logger.shareController.error(
|
||||
"""
|
||||
Error creating share: \(error.errorDescription, privacy: .public)
|
||||
"""
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +98,7 @@ class ShareController: ObservableObject {
|
|||
attributes: String? = nil,
|
||||
options: NKRequestOptions = NKRequestOptions()
|
||||
) async -> NKError? {
|
||||
Logger.shareController.info("Saving share: \(self.share.url)")
|
||||
Logger.shareController.info("Saving share: \(self.share.url, privacy: .public)")
|
||||
return await withCheckedContinuation { continuation in
|
||||
kit.updateShare(
|
||||
idShare: share.idShare,
|
||||
|
@ -104,10 +112,18 @@ class ShareController: ObservableObject {
|
|||
attributes: attributes,
|
||||
options: options
|
||||
) { account, share, data, error in
|
||||
Logger.shareController.info("Received update response: \(share?.url ?? "")")
|
||||
Logger.shareController.info(
|
||||
"""
|
||||
Received update response: \(share?.url ?? "", privacy: .public)
|
||||
"""
|
||||
)
|
||||
defer { continuation.resume(returning: error) }
|
||||
guard error == .success, let share = share else {
|
||||
Logger.shareController.error("Error updating save: \(error.errorDescription)")
|
||||
Logger.shareController.error(
|
||||
"""
|
||||
Error updating save: \(error.errorDescription, privacy: .public)
|
||||
"""
|
||||
)
|
||||
return
|
||||
}
|
||||
self.share = share
|
||||
|
@ -116,13 +132,21 @@ class ShareController: ObservableObject {
|
|||
}
|
||||
|
||||
func delete() async -> NKError? {
|
||||
Logger.shareController.info("Deleting share: \(self.share.url)")
|
||||
Logger.shareController.info("Deleting share: \(self.share.url, privacy: .public)")
|
||||
return await withCheckedContinuation { continuation in
|
||||
kit.deleteShare(idShare: share.idShare) { account, error in
|
||||
Logger.shareController.info("Received delete response: \(self.share.url)")
|
||||
Logger.shareController.info(
|
||||
"""
|
||||
Received delete response: \(self.share.url, privacy: .public)
|
||||
"""
|
||||
)
|
||||
defer { continuation.resume(returning: error) }
|
||||
guard error == .success else {
|
||||
Logger.shareController.error("Error deleting save: \(error.errorDescription)")
|
||||
Logger.shareController.error(
|
||||
"""
|
||||
Error deleting save: \(error.errorDescription, privacy: .public)
|
||||
"""
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class ShareOptionsView: NSView {
|
|||
}
|
||||
var createMode = false {
|
||||
didSet {
|
||||
Logger.shareOptionsView.info("Create mode set: \(self.createMode)")
|
||||
Logger.shareOptionsView.info("Create mode set: \(self.createMode, privacy: .public)")
|
||||
shareTypePicker.isHidden = !createMode
|
||||
shareRecipientTextField.isHidden = !createMode
|
||||
labelTextField.isHidden = createMode // Cannot set label on create API call
|
||||
|
@ -259,10 +259,10 @@ class ShareOptionsView: NSView {
|
|||
let itemServerRelativePath = dataSource.itemServerRelativePath
|
||||
else {
|
||||
Logger.shareOptionsView.error("Cannot create new share due to missing data.")
|
||||
Logger.shareOptionsView.error("dataSource: \(self.dataSource)")
|
||||
Logger.shareOptionsView.error("kit: \(self.kit)")
|
||||
Logger.shareOptionsView.error("dataSource: \(self.dataSource, privacy: .public)")
|
||||
Logger.shareOptionsView.error("kit: \(self.kit, privacy: .public)")
|
||||
Logger.shareOptionsView.error(
|
||||
"path: \(self.dataSource?.itemServerRelativePath ?? "")"
|
||||
"path: \(self.dataSource?.itemServerRelativePath ?? "", privacy: .public)"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
|
|||
optionsView.dataSource = shareDataSource
|
||||
} catch let error {
|
||||
let errorString = "Error processing item: \(error)"
|
||||
Logger.shareViewController.error("\(errorString)")
|
||||
Logger.shareViewController.error("\(errorString, privacy: .public)")
|
||||
fileNameLabel.stringValue = "Unknown item"
|
||||
descriptionLabel.stringValue = errorString
|
||||
}
|
||||
|
@ -99,7 +99,11 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
|
|||
let fileThumbnail = await withCheckedContinuation { continuation in
|
||||
generator.generateRepresentations(for: request) { thumbnail, type, error in
|
||||
if thumbnail == nil || error != nil {
|
||||
Logger.shareViewController.error("Could not get thumbnail: \(error)")
|
||||
Logger.shareViewController.error(
|
||||
"""
|
||||
Could not get thumbnail: \(error, privacy: .public)
|
||||
"""
|
||||
)
|
||||
}
|
||||
continuation.resume(returning: thumbnail)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue