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.
This commit is contained in:
Mia ZHOU 2018-08-06 17:39:09 +08:00
parent 8d66f057cd
commit ccd5ddf307

View File

@ -26,12 +26,10 @@ import { httpStatusCode, AlertType } from './shared.const';
* @returns {string} * @returns {string}
*/ */
export const errorHandler = function (error: any): string { export const errorHandler = function (error: any): string {
if (!error) { let errorObj = error.json();
return "UNKNOWN_ERROR"; if (errorObj && errorObj.error) {
}
if (!(error.statusCode || error.status)) {
// treat as string message // treat as string message
return '' + error; return errorObj.error;
} else { } else {
switch (error.statusCode || error.status) { switch (error.statusCode || error.status) {
case 400: case 400: