From ccd5ddf307540e052adb9e66589de79acb58d7fb Mon Sep 17 00:00:00 2001 From: Mia ZHOU Date: Mon, 6 Aug 2018 17:39:09 +0800 Subject: [PATCH] If user upload a not valid helm chart file, UI need to show the error from backend. Fix: Modify the error handler to use the backend error instead of frontend hardcode. --- src/ui_ng/src/app/shared/shared.utils.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui_ng/src/app/shared/shared.utils.ts b/src/ui_ng/src/app/shared/shared.utils.ts index 63a879820..5b1654cf3 100644 --- a/src/ui_ng/src/app/shared/shared.utils.ts +++ b/src/ui_ng/src/app/shared/shared.utils.ts @@ -26,12 +26,10 @@ import { httpStatusCode, AlertType } from './shared.const'; * @returns {string} */ export const errorHandler = function (error: any): string { - if (!error) { - return "UNKNOWN_ERROR"; - } - if (!(error.statusCode || error.status)) { + let errorObj = error.json(); + if (errorObj && errorObj.error) { // treat as string message - return '' + error; + return errorObj.error; } else { switch (error.statusCode || error.status) { case 400: