github.com/number571/tendermint@v0.34.11-gost/light/provider/errors.go (about)

     1  package provider
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  var (
     9  	// ErrHeightTooHigh is returned when the height is higher than the last
    10  	// block that the provider has. The light client will not remove the provider
    11  	ErrHeightTooHigh = errors.New("height requested is too high")
    12  	// ErrLightBlockNotFound is returned when a provider can't find the
    13  	// requested header (i.e. it has been pruned).
    14  	// The light client will not remove the provider
    15  	ErrLightBlockNotFound = errors.New("light block not found")
    16  	// ErrNoResponse is returned if the provider doesn't respond to the
    17  	// request in a given time. The light client will not remove the provider
    18  	ErrNoResponse = errors.New("client failed to respond")
    19  	// ErrConnectionClosed is returned if the provider closes the connection.
    20  	// In this case we remove the provider.
    21  	ErrConnectionClosed = errors.New("client closed connection")
    22  )
    23  
    24  // ErrBadLightBlock is returned when a provider returns an invalid
    25  // light block. The light client will remove the provider.
    26  type ErrBadLightBlock struct {
    27  	Reason error
    28  }
    29  
    30  func (e ErrBadLightBlock) Error() string {
    31  	return fmt.Sprintf("client provided bad signed header: %s", e.Reason.Error())
    32  }
    33  
    34  // ErrUnreliableProvider is a generic error that indicates that the provider isn't
    35  // behaving in a reliable manner to the light client. The light client will
    36  // remove the provider
    37  type ErrUnreliableProvider struct {
    38  	Reason string
    39  }
    40  
    41  func (e ErrUnreliableProvider) Error() string {
    42  	return fmt.Sprintf("client deemed unreliable: %s", e.Reason)
    43  }