github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/plugin/discovery/error.go (about)

     1  package discovery
     2  
     3  // Error is a type used to describe situations that the caller must handle
     4  // since they indicate some form of user error.
     5  //
     6  // The functions and methods that return these specialized errors indicate so
     7  // in their documentation. The Error type should not itself be used directly,
     8  // but rather errors should be compared using the == operator with the
     9  // error constants in this package.
    10  //
    11  // Values of this type are _not_ used when the error being reported is an
    12  // operational error (server unavailable, etc) or indicative of a bug in
    13  // this package or its caller.
    14  type Error string
    15  
    16  // ErrorNoSuitableVersion indicates that a suitable version (meeting given
    17  // constraints) is not available.
    18  const ErrorNoSuitableVersion = Error("no suitable version is available")
    19  
    20  // ErrorNoVersionCompatible indicates that all of the available versions
    21  // that otherwise met constraints are not compatible with the current
    22  // version of Terraform.
    23  const ErrorNoVersionCompatible = Error("no available version is compatible with this version of Terraform")
    24  
    25  // ErrorVersionIncompatible indicates that all of the versions within the
    26  // constraints are not compatible with the current version of Terrafrom, though
    27  // there does exist a version outside of the constaints that is compatible.
    28  const ErrorVersionIncompatible = Error("incompatible provider version")
    29  
    30  // ErrorNoSuchProvider indicates that no provider exists with a name given
    31  const ErrorNoSuchProvider = Error("no provider exists with the given name")
    32  
    33  // ErrorNoVersionCompatibleWithPlatform indicates that all of the available
    34  // versions that otherwise met constraints are not compatible with the
    35  // requested platform
    36  const ErrorNoVersionCompatibleWithPlatform = Error("no available version is compatible for the requested platform")
    37  
    38  // ErrorMissingChecksumVerification indicates that either the provider
    39  // distribution is missing the SHA256SUMS file or the checksum file does
    40  // not contain a checksum for the binary plugin
    41  const ErrorMissingChecksumVerification = Error("unable to verify checksum")
    42  
    43  // ErrorChecksumVerification indicates that the current checksum of the
    44  // provider plugin has changed since the initial release and is not trusted
    45  // to download
    46  const ErrorChecksumVerification = Error("unexpected plugin checksum")
    47  
    48  // ErrorSignatureVerification indicates that the digital signature for a
    49  // provider distribution could not be verified for one of the following
    50  // reasons: missing signature file, missing public key, or the signature
    51  // was not signed by any known key for the publisher
    52  const ErrorSignatureVerification = Error("unable to verify signature")
    53  
    54  // ErrorServiceUnreachable indicates that the network was unable to connect
    55  // to the registry service
    56  const ErrorServiceUnreachable = Error("registry service is unreachable")
    57  
    58  // ErrorPublicRegistryUnreachable indicates that the network was unable to connect
    59  // to the public registry in particular, so we can show a link to the statuspage
    60  const ErrorPublicRegistryUnreachable = Error("registry service is unreachable, check https://status.hashicorp.com/ for status updates")
    61  
    62  func (err Error) Error() string {
    63  	return string(err)
    64  }