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}
*/
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: