How to use the @harbor/ui.errorHandler function in @harbor/ui

To help you get started, we’ve selected a few @harbor/ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goharbor / harbor / src / portal / src / app / shared / message-handler / message-handler.service.ts View on Github external
public handleError(error: any | string): void {
        if (!error) {
            return;
        }
        let msg = errorHandler(error);

        if (!(error.statusCode || error.status)) {
            this.msgService.announceMessage(500, msg, AlertType.DANGER);
        } else {
            let code = error.statusCode || error.status;
            if (code === httpStatusCode.Unauthorized) {
                this.msgService.announceAppLevelMessage(code, msg, AlertType.DANGER);
                // Session is invalid now, clare session cache
                this.session.clear();
            } else {
                this.msgService.announceMessage(code, msg, AlertType.DANGER);
            }
        }
    }
github goharbor / harbor / src / portal / src / app / project / member / add-http-auth-group / add-http-auth-group.component.ts View on Github external
err => {
          let errorMessageKey: string = errorHandFn(err);
          this.translateService
            .get(errorMessageKey)
            .subscribe(errorMessage => this.inlineAlert.showInlineError(errorMessage));
          this.added.emit(false);
        }
      );
github goharbor / harbor / src / portal / src / app / project / helm-chart / list-charts-detail / helm-chart.component.ts View on Github external
catchError( error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operateMsg, OperationState.failure, res)
          );
          return observableThrowError(message);
        }
      )));
github goharbor / harbor / src / portal / src / app / project / helm-chart / list-chart-versions / helm-chart-versions-detail / helm-chart-version.component.ts View on Github external
catchError( error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operateMsg, OperationState.failure, res)
          );
          return observableThrowError(message);
        }
      )));
github goharbor / harbor / src / portal / src / app / group / group.component.ts View on Github external
.pipe(catchError(error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operMessage, OperationState.failure, res)
          );
          return observableThrowError(message);
        }));
    });
github goharbor / harbor / src / portal / src / app / project / member / add-group / add-group.component.ts View on Github external
error => {
                  const message = errorHandFn(error);
                  this.translateService.get(message).subscribe(res =>
                    operateChanges(operMessage, OperationState.failure, res)
                  );
                  return observableThrowError(message);
              }),
        catchError(error => observableOf(error.status)), );
github goharbor / harbor / src / portal / src / app / project / member / member.component.ts View on Github external
}), catchError(error => {
          const message = errorHandFn(error);
          this.translate.get(message).subscribe(res =>
            operateChanges(operMessage, OperationState.failure, res)
          );
          return observableThrowError(message);
        }));
    };