github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/daemon/cluster/errors.go (about)

     1  package cluster
     2  
     3  const (
     4  	// errNoSwarm is returned on leaving a cluster that was never initialized
     5  	errNoSwarm notAvailableError = "This node is not part of a swarm"
     6  
     7  	// errSwarmExists is returned on initialize or join request for a cluster that has already been activated
     8  	errSwarmExists notAvailableError = "This node is already part of a swarm. Use \"docker swarm leave\" to leave this swarm and join another one."
     9  
    10  	// errSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.
    11  	errSwarmJoinTimeoutReached notAvailableError = "Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the \"docker info\" command to see the current swarm status of your node."
    12  
    13  	// errSwarmLocked is returned if the swarm is encrypted and needs a key to unlock it.
    14  	errSwarmLocked notAvailableError = "Swarm is encrypted and needs to be unlocked before it can be used. Please use \"docker swarm unlock\" to unlock it."
    15  
    16  	// errSwarmCertificatesExpired is returned if docker was not started for the whole validity period and they had no chance to renew automatically.
    17  	errSwarmCertificatesExpired notAvailableError = "Swarm certificates have expired. To replace them, leave the swarm and join again."
    18  
    19  	// errSwarmNotManager is returned if the node is not a swarm manager.
    20  	errSwarmNotManager notAvailableError = "This node is not a swarm manager. Worker nodes can't be used to view or modify cluster state. Please run this command on a manager node or promote the current node to a manager."
    21  )
    22  
    23  type notFoundError struct {
    24  	cause error
    25  }
    26  
    27  func (e notFoundError) Error() string {
    28  	return e.cause.Error()
    29  }
    30  
    31  func (e notFoundError) NotFound() {}
    32  
    33  func (e notFoundError) Cause() error {
    34  	return e.cause
    35  }
    36  
    37  type ambiguousResultsError struct {
    38  	cause error
    39  }
    40  
    41  func (e ambiguousResultsError) Error() string {
    42  	return e.cause.Error()
    43  }
    44  
    45  func (e ambiguousResultsError) InvalidParameter() {}
    46  
    47  func (e ambiguousResultsError) Cause() error {
    48  	return e.cause
    49  }
    50  
    51  type convertError struct {
    52  	cause error
    53  }
    54  
    55  func (e convertError) Error() string {
    56  	return e.cause.Error()
    57  }
    58  
    59  func (e convertError) InvalidParameter() {}
    60  
    61  func (e convertError) Cause() error {
    62  	return e.cause
    63  }
    64  
    65  type notAllowedError string
    66  
    67  func (e notAllowedError) Error() string {
    68  	return string(e)
    69  }
    70  
    71  func (e notAllowedError) Forbidden() {}
    72  
    73  type validationError struct {
    74  	cause error
    75  }
    76  
    77  func (e validationError) Error() string {
    78  	return e.cause.Error()
    79  }
    80  
    81  func (e validationError) InvalidParameter() {}
    82  
    83  func (e validationError) Cause() error {
    84  	return e.cause
    85  }
    86  
    87  type notAvailableError string
    88  
    89  func (e notAvailableError) Error() string {
    90  	return string(e)
    91  }
    92  
    93  func (e notAvailableError) Unavailable() {}
    94  
    95  type configError string
    96  
    97  func (e configError) Error() string {
    98  	return string(e)
    99  }
   100  
   101  func (e configError) InvalidParameter() {}
   102  
   103  type invalidUnlockKey struct{}
   104  
   105  func (invalidUnlockKey) Error() string {
   106  	return "swarm could not be unlocked: invalid key provided"
   107  }
   108  
   109  func (invalidUnlockKey) Unauthorized() {}
   110  
   111  type notLockedError struct{}
   112  
   113  func (notLockedError) Error() string {
   114  	return "swarm is not locked"
   115  }
   116  
   117  func (notLockedError) Conflict() {}