From ba4f31885083f1f2d8ae577210de5138e5fb50fd Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Tue, 15 Oct 2024 18:51:21 +0200 Subject: [PATCH] [DSC-1977] Improve error handling of the item correction functionality --- .../request-correction-menu.component.ts | 10 ++++++++-- src/app/submission/submission.service.ts | 3 +-- src/assets/i18n/en.json5 | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/shared/context-menu/request-correction/request-correction-menu.component.ts b/src/app/shared/context-menu/request-correction/request-correction-menu.component.ts index b51e89aaa08..b6c97d3b42e 100644 --- a/src/app/shared/context-menu/request-correction/request-correction-menu.component.ts +++ b/src/app/shared/context-menu/request-correction/request-correction-menu.component.ts @@ -125,13 +125,19 @@ export class RequestCorrectionMenuComponent extends ContextMenuEntryComponent im case 403: this.notificationService.warning( null, - this.translate.instant('item.page.context-menu.options.request-correction.error.403') + this.translate.instant('context-menu.actions.request-correction.error.403') + ); + break; + case 422: + this.notificationService.warning( + null, + this.translate.instant('context-menu.actions.request-correction.error.422') ); break; default : this.notificationService.error( null, - this.translate.instant('item.page.context-menu.options.request-correction.error.generic') + this.translate.instant('context-menu.actions.request-correction.error.generic') ); } } diff --git a/src/app/submission/submission.service.ts b/src/app/submission/submission.service.ts index 1790a121e1f..0e1bbba2ccc 100644 --- a/src/app/submission/submission.service.ts +++ b/src/app/submission/submission.service.ts @@ -219,8 +219,7 @@ export class SubmissionService { options.params = params; return this.restService.postToEndpoint(this.workspaceLinkPath, {}, null, options).pipe( - map((workspaceitem: SubmissionObject[]) => workspaceitem[0] as SubmissionObject), - catchError(() => observableOf({} as SubmissionObject))); + map((workspaceitem: SubmissionObject[]) => workspaceitem[0] as SubmissionObject)); } /** diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index efc3df4c81e..cf75496bc08 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -1652,7 +1652,9 @@ "context-menu.actions.request-correction.confirm.submit": "Yes, I'm sure", - "context-menu.actions.request-correction.error.403": "A request for correction has already been sent, impossible to proceed with the operation.", + "context-menu.actions.request-correction.error.403": "You are not authorized, impossible to proceed with the operation.", + + "context-menu.actions.request-correction.error.422": "A correction request for this item is already in progress. Please contact the support if you need to perform urgent changes to this item.", "context-menu.actions.request-correction.error.generic": "There was an issue when requesting a correction for the item, please try again later.",