Skip to content

Commit 68e033b

Browse files
authored
Merge pull request #1432 from nextcloud-libraries/chore/add-some-more-logging
chore: Add more debug logging to trace errors
2 parents 30d964f + d57107b commit 68e033b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/uploader.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,12 @@ export class Uploader {
269269

270270
return new PCancelable(async (resolve, reject, onCancel) => {
271271
// create a meta upload to ensure all ongoing child requests are listed
272-
const upload = new Upload(`${this.root.replace(/\/$/, '')}/${destination.replace(/^\//, '')}`, false, 0, rootFolder)
272+
const target = `${this.root.replace(/\/$/, '')}/${destination.replace(/^\//, '')}`
273+
const upload = new Upload(target, false, 0, rootFolder)
273274
upload.status = UploadStatus.UPLOADING
274275
this._uploadQueue.push(upload)
276+
277+
logger.debug('Starting new batch upload', { target })
275278
try {
276279
// setup client with root and custom header
277280
const client = davGetClient(this.root, this._customHeaders)
@@ -360,9 +363,11 @@ export class Uploader {
360363
// Let the user handle conflicts
361364
const selectedForUpload = await callback(directory.children, folderPath)
362365
if (selectedForUpload === false) {
366+
logger.debug('Upload canceled by user', { directory })
363367
reject(t('Upload has been cancelled'))
364368
return
365369
} else if (selectedForUpload.length === 0 && directory.children.length > 0) {
370+
logger.debug('Skipping directory, as all files were skipped by user', { directory })
366371
resolve([])
367372
return
368373
}
@@ -375,6 +380,7 @@ export class Uploader {
375380
uploads.forEach((upload) => upload.cancel())
376381
})
377382

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

0 commit comments

Comments
 (0)