From d4fb33cf3b27379658846ddd6acd4b7dcf908f40 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Sat, 17 Mar 2018 15:42:23 -0600 Subject: [PATCH] web-ui: Display default message on server errors without message --- web-ui/src/app/app.component.ts | 1 + web-ui/src/app/services/error.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web-ui/src/app/app.component.ts b/web-ui/src/app/app.component.ts index 1c05f71..9fc1626 100644 --- a/web-ui/src/app/app.component.ts +++ b/web-ui/src/app/app.component.ts @@ -35,6 +35,7 @@ export class AppComponent { // messages 'message.serverUnavailable': 'The server unavailable, please try again in a minute', + 'message.unknownError': 'Unknown error, please try again in a minute', // actions 'action.find': 'Find', diff --git a/web-ui/src/app/services/error.service.ts b/web-ui/src/app/services/error.service.ts index a7a5051..3996a24 100644 --- a/web-ui/src/app/services/error.service.ts +++ b/web-ui/src/app/services/error.service.ts @@ -33,8 +33,8 @@ export class ErrorService { this.setFieldError(form, fieldName, message); } } else { - const message = element.message; - this.notificationService.error(message); + this.translateService.get(element.message || 'message.unknownErrors') + .subscribe(msg => this.notificationService.error(msg)); } }); }