proper messages when uploading fails

This commit is contained in:
jonaswinkler 2021-01-27 16:04:06 +01:00
parent cc74be9ccc
commit 5a4cb5fe4a
2 changed files with 9 additions and 4 deletions

View File

@ -99,14 +99,13 @@ export class UploadFileWidgetComponent implements OnInit {
}
}, error => {
status.updateProgress(FileStatusPhase.FAILED)
switch (error.status) {
case 400: {
status.message = error.error.document
this.consumerStatusService.fail(status, error.error.document)
break;
}
default: {
status.message = `${error.status} ${error.statusText}`
this.consumerStatusService.fail(status, `${error.status} ${error.statusText}`)
break;
}
}

View File

@ -117,6 +117,12 @@ export class ConsumerStatusService {
}
}
fail(status: FileStatus, message: string) {
status.message = message
status.phase = FileStatusPhase.FAILED
this.documentConsumptionFailedSubject.next(status)
}
disconnect() {
if (this.statusWebSocked) {
this.statusWebSocked.close()
@ -133,7 +139,7 @@ export class ConsumerStatusService {
}
dismissAll() {
this.consumerStatus = []
this.consumerStatus = this.consumerStatus.filter(status => status.phase < FileStatusPhase.SUCCESS)
}
onDocumentConsumptionFinished() {