github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/epochs/errors.go (about)

     1  package epochs
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  // ClusterQCNoVoteError is returned when a ClusterRootQCVoter fails to submit a vote
     9  // for reasons we consider benign, either:
    10  //   - we have reached a retry limit for transient failures
    11  //   - we have decided to not submit the vote, for example because we are not in the EpochSetup phase
    12  type ClusterQCNoVoteError struct {
    13  	Err error
    14  }
    15  
    16  func (err ClusterQCNoVoteError) Error() string {
    17  	return err.Err.Error()
    18  }
    19  
    20  func (err ClusterQCNoVoteError) Unwrap() error {
    21  	return err.Err
    22  }
    23  
    24  func NewClusterQCNoVoteErrorf(msg string, args ...interface{}) ClusterQCNoVoteError {
    25  	return ClusterQCNoVoteError{
    26  		Err: fmt.Errorf(msg, args...),
    27  	}
    28  }
    29  
    30  func IsClusterQCNoVoteError(err error) bool {
    31  	var errClusterVotingFailed ClusterQCNoVoteError
    32  	return errors.As(err, &errClusterVotingFailed)
    33  }