diff --git a/annotation-service/annotation-web/src/main/resources/config/errors.yml b/annotation-service/annotation-web/src/main/resources/config/errors.yml index 6b359871b..12a48ea12 100644 --- a/annotation-service/annotation-web/src/main/resources/config/errors.yml +++ b/annotation-service/annotation-web/src/main/resources/config/errors.yml @@ -1,4 +1,5 @@ error-thesaurus: +# common errors start with 1.. hash-conflict: code: 100 message: there is a hash conflict for the item modified. please reload to get the latest changes @@ -11,39 +12,41 @@ error-thesaurus: missing-tenant: code: 103 message: tenant scope not provided - invalid-api-key: - code: 104 - message: provided APIKey not valid - stale-api-key: - code: 105 - message: there was a problem authorizing you with your API key. Please try again. Contact the system administrator if the problem persists model-validation: code: 106 message: validation error - sensitive-info: - code: 107 - message: you are attempting to access sensitive information. please don't do that - non-person-principal: - code: 108 - message: the operation is available only to person users - blocking-consent: - code: 113 - message: user consents are not sufficient to complete the operation - single-tenant-configuration-per-type-supported: - code: 116 - message: a single tenant configuration entry per config type is supported - incompatible-tenant-configuration-types: - code: 117 - message: the provided tenant configuration type is incompatible - missing-totp-token: - code: 118 - message: totp token not provided - overlapping-tenant-configuration-notifier-list: - code: 119 - message: Overlapping Tenant Configuration Notifier List tenant-not-allowed: - code: 113 + code: 112 message: tenant not allowed tenant-tampering: - code: 123 + code: 127 message: Tenant tampering + +# annotations¬ification errors start with 2.. + invalid-api-key: + code: 200 + message: provided APIKey not valid + stale-api-key: + code: 201 + message: there was a problem authorizing you with your API key. Please try again. Contact the system administrator if the problem persists + sensitive-info: + code: 202 + message: you are attempting to access sensitive information. please don't do that + non-person-principal: + code: 203 + message: the operation is available only to person users + blocking-consent: + code: 204 + message: user consents are not sufficient to complete the operation + single-tenant-configuration-per-type-supported: + code: 205 + message: a single tenant configuration entry per config type is supported + incompatible-tenant-configuration-types: + code: 206 + message: the provided tenant configuration type is incompatible + missing-totp-token: + code: 207 + message: totp token not provided + overlapping-tenant-configuration-notifier-list: + code: 208 + message: Overlapping Tenant Configuration Notifier List diff --git a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts index 52fbbac10..5e6472f61 100644 --- a/dmp-frontend/src/app/core/common/enum/respone-error-code.ts +++ b/dmp-frontend/src/app/core/common/enum/respone-error-code.ts @@ -1,29 +1,124 @@ +import { TranslateService } from "@ngx-translate/core"; + export enum ResponseErrorCode { - HashConflict = 100, - Forbidden = 101, - SystemError = 102, - MissingTenant = 103, - ΜodelValidation = 106, - // TenantCodeRequired = 108, not used - // TenantNameRequired = 109, not used - TenantNotAllowed = 112, - DescriptionTemplateNewVersionConflict = 113, - DescriptionTemplateIsNotFinalized = 114, - MultipleDescriptionTemplateVersionsNotSupported = 115, - DmpNewVersionConflict = 116, - DmpIsNotFinalized = 117, - MultipleDmpVersionsNotSupported = 118, - DmpIsFinalized = 119, - DmpCanNotChange = 120, - DmpDescriptionTemplateCanNotChange = 121, - InvalidDescriptionTemplate = 122, - DescriptionIsFinalized = 123, - DmpBlueprintHasNoDescriptionTemplates = 124, - DmpBlueprintNewVersionConflict = 125, - DmpDescriptionTemplateCanNotRemove = 126, - TenantTampering = 127, - TenantConfigurationTypeCanNotChange = 128, - MultipleTenantConfigurationTypeNotAllowed = 129, - TenantCodeExists = 130, - DmpNewVersionAlreadyCreatedDraft = 131 + // Common Errors + HashConflict = 100, + Forbidden = 101, + SystemError = 102, + MissingTenant = 103, + ModelValidation = 106, + // TenantCodeRequired = 108, not used + // TenantNameRequired = 109, not used + TenantNotAllowed = 112, + DescriptionTemplateNewVersionConflict = 113, + DescriptionTemplateIsNotFinalized = 114, + MultipleDescriptionTemplateVersionsNotSupported = 115, + DmpNewVersionConflict = 116, + DmpIsNotFinalized = 117, + MultipleDmpVersionsNotSupported = 118, + DmpIsFinalized = 119, + DmpCanNotChange = 120, + DmpDescriptionTemplateCanNotChange = 121, + InvalidDescriptionTemplate = 122, + DescriptionIsFinalized = 123, + DmpBlueprintHasNoDescriptionTemplates = 124, + DmpBlueprintNewVersionConflict = 125, + DmpDescriptionTemplateCanNotRemove = 126, + TenantTampering = 127, + TenantConfigurationTypeCanNotChange = 128, + MultipleTenantConfigurationTypeNotAllowed = 129, + TenantCodeExists = 130, + DmpNewVersionAlreadyCreatedDraft = 131, + + // Notification & Annotation Errors + InvalidApiKey = 200, + StaleApiKey = 201, + SensitiveInfo = 202, + NonPersonPrincipal = 203, + BlockingConsent = 204, + SingleTenantConfigurationPerTypeSupported = 205, + IncompatibleTenantConfigurationTypes = 206, + MissingTotpToken = 207, + OverlappingTenantConfigurationNotifierList = 208, +} + +export class ResponseErrorCodeHelper { + public static isBackendError(statusCode: number): boolean { + return Object.values(ResponseErrorCode).includes(statusCode); + } + + public static getErrorMessageByBackendStatusCode(statusCode: number, language: TranslateService): string { + switch (statusCode) { + case ResponseErrorCode.HashConflict: + return language.instant("GENERAL.BACKEND-ERRORS.HASH-CONFLICT"); + case ResponseErrorCode.Forbidden: + return language.instant("GENERAL.BACKEND-ERRORS.FORBIDDEN"); + case ResponseErrorCode.SystemError: + return language.instant("GENERAL.BACKEND-ERRORS.SYSTEM-ERROR"); + case ResponseErrorCode.MissingTenant: + return language.instant("GENERAL.BACKEND-ERRORS.MISSING-TENANT"); + case ResponseErrorCode.ModelValidation: + return language.instant("GENERAL.BACKEND-ERRORS.MODEL-VALIDATION"); + case ResponseErrorCode.TenantNotAllowed: + return language.instant("GENERAL.BACKEND-ERRORS.TENANT-NOT-ALLOWED"); + case ResponseErrorCode.DescriptionTemplateNewVersionConflict: + return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT"); + case ResponseErrorCode.DescriptionTemplateIsNotFinalized: + return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED"); + case ResponseErrorCode.MultipleDescriptionTemplateVersionsNotSupported: + return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED"); + case ResponseErrorCode.DmpNewVersionConflict: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-CONFLICT"); + case ResponseErrorCode.DmpIsNotFinalized: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-NOT-FINALIZED"); + case ResponseErrorCode.MultipleDmpVersionsNotSupported: + return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED"); + case ResponseErrorCode.DmpIsFinalized: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-FINALIZED"); + case ResponseErrorCode.DmpCanNotChange: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-CAN-NOT-CHANGE"); + case ResponseErrorCode.DmpDescriptionTemplateCanNotChange: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE"); + case ResponseErrorCode.InvalidDescriptionTemplate: + return language.instant("GENERAL.BACKEND-ERRORS.INVALID-DESCRIPTION-TEMPLATE"); + case ResponseErrorCode.DescriptionIsFinalized: + return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-IS-FINALIZED"); + case ResponseErrorCode.DmpBlueprintHasNoDescriptionTemplates: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES"); + case ResponseErrorCode.DmpBlueprintNewVersionConflict: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-NEW-VERSION-CONFLICT"); + case ResponseErrorCode.DmpDescriptionTemplateCanNotRemove: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE"); + case ResponseErrorCode.TenantTampering: + return language.instant("GENERAL.BACKEND-ERRORS.TENANT-TAMPERING"); + case ResponseErrorCode.TenantConfigurationTypeCanNotChange: + return language.instant("GENERAL.BACKEND-ERRORS.TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE"); + case ResponseErrorCode.MultipleTenantConfigurationTypeNotAllowed: + return language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED"); + case ResponseErrorCode.TenantCodeExists: + return language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"); + case ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft: + return language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-ALREADY-CREATED-DRAFT"); + case ResponseErrorCode.InvalidApiKey: + return language.instant("GENERAL.BACKEND-ERRORS.INVALID-API-KEY"); + case ResponseErrorCode.StaleApiKey: + return language.instant("GENERAL.BACKEND-ERRORS.STALE-API-KEY"); + case ResponseErrorCode.SensitiveInfo: + return language.instant("GENERAL.BACKEND-ERRORS.SENSITIVE-INFO"); + case ResponseErrorCode.NonPersonPrincipal: + return language.instant("GENERAL.BACKEND-ERRORS.NON-PERSON-PRINCIPAL"); + case ResponseErrorCode.BlockingConsent: + return language.instant("GENERAL.BACKEND-ERRORS.BLOCKING-CONSENT"); + case ResponseErrorCode.SingleTenantConfigurationPerTypeSupported: + return language.instant("GENERAL.BACKEND-ERRORS.SINGLE-TENANT-CONFIGURATION-PER-TYPE-SUPPORTED"); + case ResponseErrorCode.IncompatibleTenantConfigurationTypes: + return language.instant("GENERAL.BACKEND-ERRORS.INCOMPATIBLE-TENANT-CONFIGURATION-TYPES"); + case ResponseErrorCode.MissingTotpToken: + return language.instant("GENERAL.BACKEND-ERRORS.MISSING-TOTP-TOKEN"); + case ResponseErrorCode.OverlappingTenantConfigurationNotifierList: + return language.instant("GENERAL.BACKEND-ERRORS.OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST"); + default: + return language.instant("GENERAL.SNACK-BAR.NOT-FOUND"); + } + } } diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts index 14ce87d23..439db7b97 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts @@ -36,6 +36,7 @@ import { StartNewDescriptionDialogComponent } from '../start-new-description-dia import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component'; import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; +import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; @Component({ selector: 'app-description-listing-component', @@ -104,6 +105,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit private httpClient: HttpClient, private analyticsService: AnalyticsService, private fb: UntypedFormBuilder, + private httpErrorHandlingService: HttpErrorHandlingService, ) { super(); } @@ -262,7 +264,8 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit if (lookup?.page?.offset === 0) this.listingItems = []; this.listingItems.push(...result.items); this.hasListingItems = true; - }); + }, + (error) => this.httpErrorHandlingService.handleBackedRequestError(error)); }else{ this.descriptionService.query(lookup).pipe(takeUntil(this._destroyed)) .subscribe(result => { @@ -273,9 +276,9 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit if (description.status != DescriptionStatus.Canceled) this.listingItems.push(description); }) this.hasListingItems = true; - }); + }, + (error) => this.httpErrorHandlingService.handleBackedRequestError(error)); } - } openFiltersDialog(): void { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 41b373314..0ff7a40b8 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -44,9 +44,9 @@ "DMP-IS-NOT-FINALIZED": "The selected DMP is not finalized.", "MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED": "Multiple versions of the selected DMP where found. Please contact your administrator.", "DMP-IS-FINALIZED": "The requested action cannot be completed as the DMP has been finalized. To proceed, please revert the finalization.", - "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occured. You cannot modify the Description's associated DMP.", - "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occured. You cannot modify the Description's associated DMP's Description Template.", - "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occured. The Description's associated DMP's Description Template is invalid.", + "DMP-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP.", + "DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE": "While tying to update your Description, a validation error occurred. You cannot modify the Description's associated DMP's Description Template.", + "INVALID-DESCRIPTION-TEMPLATE": "While tying to update your Description, a validation error occurred. The Description's associated DMP's Description Template is invalid.", "DESCRIPTION-IS-FINALIZED": "The requested action cannot be completed as the Description has been finalized. To proceed, please revert the finalization.", "DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES": "You need to select at least one Description Template. Click the 'Has Description Templates' button to proceed.", "DMP-BLUEPRINT-NEW-VERSION-CONFLICT": "While trying to update your Blueprint, a version conflict occurred. Your Blueprint is not in the latest version.", @@ -55,7 +55,16 @@ "TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE": "The configuration type for this Tenant cannot be changed.", "MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED": "Tenant Configuration already exists for this Tenant.", "TENANT-CODE-EXISTS": "The Tenant code you provided already exists. Please choose a different code.", - "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan." + "DMP-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this plan.", + "INVALID-API-KEY": "Invalid configurations detected. Please contact your administrator.", + "STALE-API-KEY": "A problem occurred while trying to authorize you. Please try refreshing the page or logging in again. Contact the system administrator if the problem persists.", + "SENSITIVE-INFO": "You've reached a section that contains sensitive information. To protect your privacy, please head back to the public area of the site or log in with your authorized account to access this information.", + "NON-PERSON-PRINCIPAL": "The operation is unavailable. Please contact your administrator.", + "BLOCKING-CONSENT": "We cannot complete your request due to missing permissions. Please review your account settings.", + "SINGLE-TENANT-CONFIGURATION-PER-TYPE-SUPPORTED": "Could not process your request. Tenant Configuration already exists for this Tenant.", + "INCOMPATIBLE-TENANT-CONFIGURATION-TYPES": "Something went wrong while trying to update your tenant configurations. Please try again or contact your administrator.", + "MISSING-TOTP-TOKEN": "We could not process your request or the operation is unavailable. Please contact your administrator.", + "OVERLAPPING-TENANT-CONFIGURATION-NOTIFIER-LIST": "An error occurred due to overlapping configurations. Please try again or contact your administrator." }, "FORM-VALIDATION-DISPLAY-DIALOG": { "WARNING": "Warning!", diff --git a/dmp-frontend/src/common/modules/errors/error-handling/http-error-handling.service.ts b/dmp-frontend/src/common/modules/errors/error-handling/http-error-handling.service.ts index c6fcddbcb..09dd7e638 100644 --- a/dmp-frontend/src/common/modules/errors/error-handling/http-error-handling.service.ts +++ b/dmp-frontend/src/common/modules/errors/error-handling/http-error-handling.service.ts @@ -1,6 +1,6 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ResponseErrorCode } from '@app/core/common/enum/respone-error-code'; +import { ResponseErrorCode, ResponseErrorCodeHelper } from '@app/core/common/enum/respone-error-code'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { TranslateService } from '@ngx-translate/core'; @@ -16,82 +16,10 @@ export class HttpErrorHandlingService { const error: HttpError = this.getError(errorResponse); let errorMessage = messageOvverrides?.has(error.statusCode) ? messageOvverrides?.get(error.statusCode) : null; - if(errorResponse.error.code === ResponseErrorCode.HashConflict){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.HASH-CONFLICT"), SnackBarNotificationLevel.Error); + if(errorResponse.error && ResponseErrorCodeHelper.isBackendError(errorResponse.error?.code)){ + this.uiNotificationService.snackBarNotification(ResponseErrorCodeHelper.getErrorMessageByBackendStatusCode(errorResponse.error.code, this.language), SnackBarNotificationLevel.Error); } - else if(errorResponse.error.code === ResponseErrorCode.Forbidden){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.FORBIDDEN"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.SystemError){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.SYSTEM-ERROR"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.MissingTenant){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.MISSING-TENANT"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.ΜodelValidation){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.MODEL-VALIDATION"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.TenantNotAllowed){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-NOT-ALLOWED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DescriptionTemplateNewVersionConflict){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-NEW-VERSION-CONFLICT"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DescriptionTemplateIsNotFinalized){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-IS-NOT-FINALIZED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.MultipleDescriptionTemplateVersionsNotSupported){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DESCRIPTION-TEMPLATE-VERSIONS-NOT-SUPPORTED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpNewVersionConflict){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-CONFLICT"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpIsNotFinalized){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-NOT-FINALIZED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.MultipleDmpVersionsNotSupported){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-DMP-VERSIONS-NOT-SUPPORTED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpIsFinalized){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-IS-FINALIZED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpCanNotChange){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-CAN-NOT-CHANGE"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotChange){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-CHANGE"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.InvalidDescriptionTemplate){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.INVALID-DESCRIPTION-TEMPLATE"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DescriptionIsFinalized){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-IS-FINALIZED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpBlueprintHasNoDescriptionTemplates){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-HAS-NO-DESCRIPTION-TEMPLATES"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpBlueprintNewVersionConflict){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-BLUEPRINT-NEW-VERSION-CONFLICT"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotRemove){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-DESCRIPTION-TEMPLATE-CAN-NOT-REMOVE"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.TenantTampering){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-TAMPERING"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.TenantConfigurationTypeCanNotChange){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CONFIGURATION-TYPE-CAN-NOT-CHANGE"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.MultipleTenantConfigurationTypeNotAllowed){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.MULTIPLE-TENANT-CONFIGURATION-TYPE-NOT-ALLOWED"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.TenantCodeExists){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.TENANT-CODE-EXISTS"), SnackBarNotificationLevel.Error); - } - else if(errorResponse.error.code === ResponseErrorCode.DmpNewVersionAlreadyCreatedDraft){ - this.uiNotificationService.snackBarNotification(this.language.instant("GENERAL.BACKEND-ERRORS.DMP-NEW-VERSION-ALREADY-CREATED-DRAFT"), SnackBarNotificationLevel.Error); - } - else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 404) { + else if (error.statusCode === 302 || error.statusCode === 400 || error.statusCode === 403 || error.statusCode === 404) { errorMessage ??= this.language.instant('GENERAL.SNACK-BAR.NOT-FOUND'); this.uiNotificationService.snackBarNotification(errorMessage, SnackBarNotificationLevel.Warning); } diff --git a/notification-service/notification-web/src/main/resources/config/errors.yml b/notification-service/notification-web/src/main/resources/config/errors.yml index fdc56fa48..3764076c2 100644 --- a/notification-service/notification-web/src/main/resources/config/errors.yml +++ b/notification-service/notification-web/src/main/resources/config/errors.yml @@ -1,4 +1,5 @@ error-thesaurus: +# common errors start with 1.. hash-conflict: code: 100 message: there is a hash conflict for the item modified. please reload to get the latest changes @@ -11,45 +12,48 @@ error-thesaurus: missing-tenant: code: 103 message: tenant scope not provided - invalid-api-key: - code: 104 - message: provided APIKey not valid - stale-api-key: - code: 105 - message: there was a problem authorizing you with your API key. Please try again. Contact the system administrator if the problem persists model-validation: code: 106 message: validation error - sensitive-info: - code: 107 - message: you are attempting to access sensitive information. please don't do that - non-person-principal: - code: 108 - message: the operation is available only to person users tenant-not-allowed: - code: 113 + code: 112 message: tenant not allowed - blocking-consent: - code: 114 - message: user consents are not sufficient to complete the operation - single-tenant-configuration-per-type-supported: - code: 116 - message: a single tenant configuration entry per config type is supported - incompatible-tenant-configuration-types: - code: 117 - message: the provided tenant configuration type is incompatible - missing-totp-token: - code: 118 - message: totp token not provided - overlapping-tenant-configuration-notifier-list: - code: 119 - message: Overlapping Tenant Configuration Notifier List tenant-tampering: - code: 123 + code: 127 message: Tenant tampering tenant-configuration-type-can-not-change: - code: 124 + code: 128 message: Tenant configuration type can not change multiple-tenant-configuration-type-not-allowed: - code: 125 + code: 129 message: Multiple Tenant Configuration Type Not Allowed + +# annotations¬ification errors start with 2.. + invalid-api-key: + code: 200 + message: provided APIKey not valid + stale-api-key: + code: 201 + message: there was a problem authorizing you with your API key. Please try again. Contact the system administrator if the problem persists + sensitive-info: + code: 202 + message: you are attempting to access sensitive information. please don't do that + non-person-principal: + code: 203 + message: the operation is available only to person users + blocking-consent: + code: 204 + message: user consents are not sufficient to complete the operation + single-tenant-configuration-per-type-supported: + code: 205 + message: a single tenant configuration entry per config type is supported + incompatible-tenant-configuration-types: + code: 206 + message: the provided tenant configuration type is incompatible + missing-totp-token: + code: 207 + message: totp token not provided + overlapping-tenant-configuration-notifier-list: + code: 208 + message: Overlapping Tenant Configuration Notifier List + \ No newline at end of file