mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-03 05:21:38 +01:00
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:
parent
8d66f057cd
commit
ccd5ddf307
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user