// handleErrorFunc updates the error status of a landscaper deployment
handleErrorFunc updates the error status of a landscaper deployment
// handleErrorFunc updates the error status of a landscaper deployment
func handleErrorFunc(log logr.Logger, client client.Client, deployment *lssv1alpha1.LandscaperDeployment) func(ctx context.Context, err error) error {
	old := deployment.DeepCopy()
	return func(ctx context.Context, err error) error {
		deployment.Status.LastError = lsserrors.TryUpdateError(deployment.Status.LastError, err)
		if !reflect.DeepEqual(old.Status, deployment.Status) {
			if err2 := client.Status().Update(ctx, deployment); err2 != nil {
				if apierrors.IsConflict(err2) {
					log.V(5).Info(fmt.Sprintf("unable to update status: %s", err2.Error()))
				} else {
					log.Error(err2, "unable to update status")
				}
				if err != nil {
					return err2
				}
			}
		}
		return err
	}
}
func handleErrorFunc ( log logr . Logger , client client . Client , deployment * lssv1alpha1 . LandscaperDeployment ) func ( ctx context . Context , err error ) error { old := deployment . DeepCopy ( ) return func ( ctx context . Context , err error ) error { deployment . Status . LastError = lsserrors . TryUpdateError ( deployment . Status . LastError , err ) if ! reflect . DeepEqual ( old . Status , deployment . Status ) { if err2 := client . Status ( ) . Update ( ctx , deployment ) ; err2 != nil { if apierrors . IsConflict ( err2 ) { log . V ( 5 ) . Info ( fmt . Sprintf ( " " , err2 . Error ( ) ) ) } else { log . Error ( err2 , " " ) } if err != nil { return err2 } } } return err } }
handleErrorFunc updates the error status of a landscaper deployment
handleErrorFunc updates the error status of a landscaper deployment
// reduce logging // retry on conflict