RED-3800: fixed generic errors.
This commit is contained in:
parent
33441d16c9
commit
740d4cf071
@ -1,7 +1,7 @@
|
||||
import { ErrorHandler, Inject, Injectable, Injector } from '@angular/core';
|
||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||
import { Toaster } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { genericErrorTranslations } from '@translations/generic-error-translations';
|
||||
|
||||
@Injectable()
|
||||
export class GlobalErrorHandler extends ErrorHandler {
|
||||
@ -18,7 +18,7 @@ export class GlobalErrorHandler extends ErrorHandler {
|
||||
if (err.error.message) {
|
||||
toaster.rawError(err.error.message);
|
||||
} else if ([400, 403, 404, 409, 500].includes(err.status)) {
|
||||
toaster.rawError(_(`generic-errors.${err.status}`));
|
||||
toaster.error(genericErrorTranslations[err.status]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
export const genericErrorTranslations: { [key: number]: string } = {
|
||||
400: _('generic-errors.400'),
|
||||
403: _('generic-errors.403'),
|
||||
404: _('generic-errors.404'),
|
||||
409: _('generic-errors.409'),
|
||||
500: _('generic-errors.500'),
|
||||
};
|
||||
@ -1716,6 +1716,13 @@
|
||||
},
|
||||
"title": "SMTP-Konto konfigurieren"
|
||||
},
|
||||
"generic-errors": {
|
||||
"400": "Die gesendete Anfrage ist ungültig.",
|
||||
"403": "Der Zugriff auf die angeforderte Ressource ist nicht erlaubt.",
|
||||
"404": "Die angeforderte Ressource konnte nicht gefunden werden.",
|
||||
"409": "Die Anfrage ist mit dem aktuellen Zustand nicht vereinbar.",
|
||||
"500": "Der Server ist auf eine unerwartete Bedingung gestoßen, die ihn daran hindert, die Anfrage zu erfüllen."
|
||||
},
|
||||
"help-button": {
|
||||
"disable": "Hilfemodus deaktivieren",
|
||||
"enable": "Hilfemodus aktivieren"
|
||||
@ -2219,7 +2226,7 @@
|
||||
"label": "In diesem Kontext aus Dossier entfernen"
|
||||
},
|
||||
"in-document": {
|
||||
"description": "{isImage, select, image{Das Bild} other{Der Begriff}} wird auf keiner Seite dieses Dokuments automatisch geschwärzt.",
|
||||
"description": "{isImage, select, image{{number, plural, one{Das Bild} other{Die Bilder}}} other{{number, plural, one{Der Begriff} other{Die Begriffe}}}} werden auf keiner Seite dieses Dokuments automatisch geschwärzt.\n",
|
||||
"label": "Aus Dokument entfernen"
|
||||
},
|
||||
"in-dossier": {
|
||||
|
||||
@ -1716,6 +1716,13 @@
|
||||
},
|
||||
"title": "Configure SMTP account"
|
||||
},
|
||||
"generic-errors": {
|
||||
"400": "The sent request is invalid.",
|
||||
"403": "Access to the requested resource is not allowed.",
|
||||
"404": "The requested resource could not be found.",
|
||||
"409": "The request is incompatible with the current state.",
|
||||
"500": "The server encountered an unexpected condition that prevented it from fulfilling the request."
|
||||
},
|
||||
"help-button": {
|
||||
"disable": "Disable help mode",
|
||||
"enable": "Enable help mode"
|
||||
@ -2219,7 +2226,7 @@
|
||||
"label": "Remove from dossier in this context"
|
||||
},
|
||||
"in-document": {
|
||||
"description": "Do not auto-redact the selected {isImage, select, image{image} other{term}} on any page of this document.",
|
||||
"description": "Do not auto-redact the selected {isImage, select, image{{number, plural, one{image} other{images}}} other{{number, plural, one{term} other{terms}}}} on any page of this document.\n",
|
||||
"label": "Remove from document"
|
||||
},
|
||||
"in-dossier": {
|
||||
|
||||
@ -1716,6 +1716,13 @@
|
||||
},
|
||||
"title": "SMTP-Konto konfigurieren"
|
||||
},
|
||||
"generic-errors": {
|
||||
"400": "The sent request is not valid.",
|
||||
"403": "Access to the requested resource is not allowed.",
|
||||
"404": "The requested resource could not be found.",
|
||||
"409": "The request is incompatible with the current state.",
|
||||
"500": "The server encountered an unexpected condition that prevented it from fulfilling the request."
|
||||
},
|
||||
"help-button": {
|
||||
"disable": "Hilfemodus deaktivieren",
|
||||
"enable": "Hilfemodus aktivieren"
|
||||
|
||||
@ -1716,6 +1716,13 @@
|
||||
},
|
||||
"title": "Configure SMTP Account"
|
||||
},
|
||||
"generic-errors": {
|
||||
"400": "The sent request is not valid.",
|
||||
"403": "Access to the requested resource is not allowed.",
|
||||
"404": "The requested resource could not be found.",
|
||||
"409": "The request is incompatible with the current state.",
|
||||
"500": "The server encountered an unexpected condition that prevented it from fulfilling the request."
|
||||
},
|
||||
"help-button": {
|
||||
"disable": "Disable help mode",
|
||||
"enable": "Enable help mode"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user