github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/deprovisioning/utils.go (about)

     1  package deprovisioning
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/kyma-project/kyma-environment-broker/internal"
     7  	kebError "github.com/kyma-project/kyma-environment-broker/internal/error"
     8  	"github.com/sirupsen/logrus"
     9  )
    10  
    11  func handleError(stepName string, operation internal.Operation, err error,
    12  	log logrus.FieldLogger, msg string) (internal.Operation, time.Duration, error) {
    13  
    14  	if kebError.IsTemporaryError(err) {
    15  		if time.Since(operation.CreatedAt) < 30*time.Minute {
    16  			log.Errorf("%s: %s. Retry...", msg, err)
    17  			return operation, 10 * time.Second, nil
    18  		}
    19  	}
    20  
    21  	log.Errorf("Step %s failed: %s.", stepName, err)
    22  	return operation, 0, nil
    23  }