Skip to content

Commit

Permalink
Merge pull request #953 from nextcloud-libraries/fix/failure-response
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Nov 9, 2023
2 parents 78ba099 + a4443b9 commit 5ac5c93
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
@@ -1,4 +1,4 @@
import { CanceledError } from 'axios'
import { CanceledError, type AxiosError, type AxiosResponse } from 'axios'
import { generateRemoteUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
import { Folder, Permission } from '@nextcloud/files'
Expand Down Expand Up @@ -295,6 +295,12 @@ export class Uploader {
reject('Upload has been cancelled')
return
}

// Attach response to the upload object
if ((error as AxiosError)?.response) {
upload.response = (error as AxiosError).response as AxiosResponse
}

upload.status = UploadStatus.FAILED
logger.error(`Failed uploading ${file.name}`, { error, file, upload })
reject('Failed uploading the file')
Expand Down

0 comments on commit 5ac5c93

Please sign in to comment.