mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-29 05:47:31 +02: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}
|
* @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:
|
||||||
|
Loading…
Reference in New Issue
Block a user