Skip to content

Commit

Permalink
chore: Add more debug logging to trace errors
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Oct 8, 2024
1 parent 921d8a3 commit d57107b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,12 @@ export class Uploader {

return new PCancelable(async (resolve, reject, onCancel) => {
// create a meta upload to ensure all ongoing child requests are listed
const upload = new Upload(`${this.root.replace(/\/$/, '')}/${destination.replace(/^\//, '')}`, false, 0, rootFolder)
const target = `${this.root.replace(/\/$/, '')}/${destination.replace(/^\//, '')}`
const upload = new Upload(target, false, 0, rootFolder)
upload.status = UploadStatus.UPLOADING
this._uploadQueue.push(upload)

logger.debug('Starting new batch upload', { target })
try {
// setup client with root and custom header
const client = davGetClient(this.root, this._customHeaders)
Expand Down Expand Up @@ -360,9 +363,11 @@ export class Uploader {
// Let the user handle conflicts
const selectedForUpload = await callback(directory.children, folderPath)
if (selectedForUpload === false) {
logger.debug('Upload canceled by user', { directory })
reject(t('Upload has been cancelled'))
return
} else if (selectedForUpload.length === 0 && directory.children.length > 0) {
logger.debug('Skipping directory, as all files were skipped by user', { directory })
resolve([])
return
}
Expand All @@ -375,6 +380,7 @@ export class Uploader {
uploads.forEach((upload) => upload.cancel())
})

logger.debug('Start directory upload', { directory })
try {
if (directory.name) {
// If not the virtual root we need to create the directory first before uploading
Expand Down

0 comments on commit d57107b

Please sign in to comment.