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(
|
override func prepare(
|
||||||
forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]
|
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" {
|
if actionIdentifier == "com.nextcloud.desktopclient.FileProviderUIExt.ShareAction" {
|
||||||
prepare(childViewController: ShareViewController(itemIdentifiers))
|
prepare(childViewController: ShareViewController(itemIdentifiers))
|
||||||
|
@ -43,7 +43,11 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
override func prepare(forError error: Error) {
|
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() {
|
override public func loadView() {
|
||||||
|
|
|
@ -42,14 +42,18 @@ class ShareController: ObservableObject {
|
||||||
) { account, share, data, error in
|
) { account, share, data, error in
|
||||||
defer { continuation.resume(returning: error) }
|
defer { continuation.resume(returning: error) }
|
||||||
guard error == .success else {
|
guard error == .success else {
|
||||||
Logger.shareController.error("Error creating link share: \(error)")
|
Logger.shareController.error(
|
||||||
|
"""
|
||||||
|
Error creating link share: \(error.errorDescription, privacy: .public)
|
||||||
|
"""
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
guard let shareWith = shareWith else {
|
guard let shareWith = shareWith else {
|
||||||
let errorString = "No recipient for share!"
|
let errorString = "No recipient for share!"
|
||||||
Logger.shareController.error("\(errorString)")
|
Logger.shareController.error("\(errorString, privacy: .public)")
|
||||||
let error = NKError(statusCode: 0, fallbackDescription: errorString)
|
let error = NKError(statusCode: 0, fallbackDescription: errorString)
|
||||||
continuation.resume(returning: error)
|
continuation.resume(returning: error)
|
||||||
return
|
return
|
||||||
|
@ -66,7 +70,11 @@ class ShareController: ObservableObject {
|
||||||
) { account, share, data, error in
|
) { account, share, data, error in
|
||||||
defer { continuation.resume(returning: error) }
|
defer { continuation.resume(returning: error) }
|
||||||
guard error == .success else {
|
guard error == .success else {
|
||||||
Logger.shareController.error("Error creating share: \(error)")
|
Logger.shareController.error(
|
||||||
|
"""
|
||||||
|
Error creating share: \(error.errorDescription, privacy: .public)
|
||||||
|
"""
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +98,7 @@ class ShareController: ObservableObject {
|
||||||
attributes: String? = nil,
|
attributes: String? = nil,
|
||||||
options: NKRequestOptions = NKRequestOptions()
|
options: NKRequestOptions = NKRequestOptions()
|
||||||
) async -> NKError? {
|
) 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
|
return await withCheckedContinuation { continuation in
|
||||||
kit.updateShare(
|
kit.updateShare(
|
||||||
idShare: share.idShare,
|
idShare: share.idShare,
|
||||||
|
@ -104,10 +112,18 @@ class ShareController: ObservableObject {
|
||||||
attributes: attributes,
|
attributes: attributes,
|
||||||
options: options
|
options: options
|
||||||
) { account, share, data, error in
|
) { 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) }
|
defer { continuation.resume(returning: error) }
|
||||||
guard error == .success, let share = share else {
|
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
|
return
|
||||||
}
|
}
|
||||||
self.share = share
|
self.share = share
|
||||||
|
@ -116,13 +132,21 @@ class ShareController: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func delete() async -> NKError? {
|
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
|
return await withCheckedContinuation { continuation in
|
||||||
kit.deleteShare(idShare: share.idShare) { account, error 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) }
|
defer { continuation.resume(returning: error) }
|
||||||
guard error == .success else {
|
guard error == .success else {
|
||||||
Logger.shareController.error("Error deleting save: \(error.errorDescription)")
|
Logger.shareController.error(
|
||||||
|
"""
|
||||||
|
Error deleting save: \(error.errorDescription, privacy: .public)
|
||||||
|
"""
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ShareOptionsView: NSView {
|
||||||
}
|
}
|
||||||
var createMode = false {
|
var createMode = false {
|
||||||
didSet {
|
didSet {
|
||||||
Logger.shareOptionsView.info("Create mode set: \(self.createMode)")
|
Logger.shareOptionsView.info("Create mode set: \(self.createMode, privacy: .public)")
|
||||||
shareTypePicker.isHidden = !createMode
|
shareTypePicker.isHidden = !createMode
|
||||||
shareRecipientTextField.isHidden = !createMode
|
shareRecipientTextField.isHidden = !createMode
|
||||||
labelTextField.isHidden = createMode // Cannot set label on create API call
|
labelTextField.isHidden = createMode // Cannot set label on create API call
|
||||||
|
@ -259,10 +259,10 @@ class ShareOptionsView: NSView {
|
||||||
let itemServerRelativePath = dataSource.itemServerRelativePath
|
let itemServerRelativePath = dataSource.itemServerRelativePath
|
||||||
else {
|
else {
|
||||||
Logger.shareOptionsView.error("Cannot create new share due to missing data.")
|
Logger.shareOptionsView.error("Cannot create new share due to missing data.")
|
||||||
Logger.shareOptionsView.error("dataSource: \(self.dataSource)")
|
Logger.shareOptionsView.error("dataSource: \(self.dataSource, privacy: .public)")
|
||||||
Logger.shareOptionsView.error("kit: \(self.kit)")
|
Logger.shareOptionsView.error("kit: \(self.kit, privacy: .public)")
|
||||||
Logger.shareOptionsView.error(
|
Logger.shareOptionsView.error(
|
||||||
"path: \(self.dataSource?.itemServerRelativePath ?? "")"
|
"path: \(self.dataSource?.itemServerRelativePath ?? "", privacy: .public)"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
|
||||||
optionsView.dataSource = shareDataSource
|
optionsView.dataSource = shareDataSource
|
||||||
} catch let error {
|
} catch let error {
|
||||||
let errorString = "Error processing item: \(error)"
|
let errorString = "Error processing item: \(error)"
|
||||||
Logger.shareViewController.error("\(errorString)")
|
Logger.shareViewController.error("\(errorString, privacy: .public)")
|
||||||
fileNameLabel.stringValue = "Unknown item"
|
fileNameLabel.stringValue = "Unknown item"
|
||||||
descriptionLabel.stringValue = errorString
|
descriptionLabel.stringValue = errorString
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,11 @@ class ShareViewController: NSViewController, ShareViewDataSourceUIDelegate {
|
||||||
let fileThumbnail = await withCheckedContinuation { continuation in
|
let fileThumbnail = await withCheckedContinuation { continuation in
|
||||||
generator.generateRepresentations(for: request) { thumbnail, type, error in
|
generator.generateRepresentations(for: request) { thumbnail, type, error in
|
||||||
if thumbnail == nil || error != nil {
|
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)
|
continuation.resume(returning: thumbnail)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue