]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/registry/errors.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / registry / errors.go
index b8dcd31e3b700d711a3f6582382a4a5c41316979..5a6a31b0806751c8d7c6f17478f87a1b4b782249 100644 (file)
@@ -4,6 +4,7 @@ import (
        "fmt"
 
        "github.com/hashicorp/terraform/registry/regsrc"
+       "github.com/hashicorp/terraform/svchost/disco"
 )
 
 type errModuleNotFound struct {
@@ -21,3 +22,42 @@ func IsModuleNotFound(err error) bool {
        _, ok := err.(*errModuleNotFound)
        return ok
 }
+
+type errProviderNotFound struct {
+       addr *regsrc.TerraformProvider
+}
+
+func (e *errProviderNotFound) Error() string {
+       return fmt.Sprintf("provider %s not found", e.addr)
+}
+
+// IsProviderNotFound returns true only if the given error is a "provider not found"
+// error. This allows callers to recognize this particular error condition
+// as distinct from operational errors such as poor network connectivity.
+func IsProviderNotFound(err error) bool {
+       _, ok := err.(*errProviderNotFound)
+       return ok
+}
+
+// IsServiceNotProvided returns true only if the given error is a "service not provided"
+// error. This allows callers to recognize this particular error condition
+// as distinct from operational errors such as poor network connectivity.
+func IsServiceNotProvided(err error) bool {
+       _, ok := err.(*disco.ErrServiceNotProvided)
+       return ok
+}
+
+// ServiceUnreachableError Registry service is unreachable
+type ServiceUnreachableError struct {
+       err error
+}
+
+func (e *ServiceUnreachableError) Error() string {
+       return e.err.Error()
+}
+
+// IsServiceUnreachable returns true if the registry/discovery service was unreachable
+func IsServiceUnreachable(err error) bool {
+       _, ok := err.(*ServiceUnreachableError)
+       return ok
+}