[ACA-2056] Upload - not able to cancel upload after upload fails due to No network connection (#839)

* resolve unknown response status

* fallback error is null

* Update src/app/components/upload-dialog/file-uploading-dialog.component.ts

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>
This commit is contained in:
Cilibiu Bogdan
2018-11-29 15:47:54 +02:00
committed by Denys Vuika
parent 2e72dc1c6c
commit 48127a2421

View File

@@ -93,10 +93,13 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
// todo: move to ADF ACA-2051
this.errorSubscription = this.uploadService.fileUploadError.subscribe(
(event: FileUploadErrorEvent) => {
const statusCode = (event.error || {}).response
? event.error.response.statusCode
: null;
this.errors.push({
fileName: event.file.name,
status: event.error.response.statusCode,
message: this.getUploadErrorMessage(event.error.response.statusCode)
status: statusCode,
message: this.getUploadErrorMessage(statusCode)
});
this.totalErrors = event.totalError;
this.changeDetector.detectChanges();
@@ -183,9 +186,10 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
500: 'APP.MESSAGES.UPLOAD.ERROR.500',
504: 'APP.MESSAGES.UPLOAD.ERROR.504',
403: 'APP.MESSAGES.UPLOAD.ERROR.403',
404: 'APP.MESSAGES.UPLOAD.ERROR.404'
404: 'APP.MESSAGES.UPLOAD.ERROR.404',
generic: 'APP.MESSAGES.UPLOAD.ERROR.GENERIC'
};
return messages[status];
return messages[status] || messages['generic'];
}
}