6 "github.com/hashicorp/terraform/registry/regsrc"
7 "github.com/hashicorp/terraform/svchost/disco"
10 type errModuleNotFound struct {
14 func (e *errModuleNotFound) Error() string {
15 return fmt.Sprintf("module %s not found", e.addr)
18 // IsModuleNotFound returns true only if the given error is a "module not found"
19 // error. This allows callers to recognize this particular error condition
20 // as distinct from operational errors such as poor network connectivity.
21 func IsModuleNotFound(err error) bool {
22 _, ok := err.(*errModuleNotFound)
26 type errProviderNotFound struct {
27 addr *regsrc.TerraformProvider
30 func (e *errProviderNotFound) Error() string {
31 return fmt.Sprintf("provider %s not found", e.addr)
34 // IsProviderNotFound returns true only if the given error is a "provider not found"
35 // error. This allows callers to recognize this particular error condition
36 // as distinct from operational errors such as poor network connectivity.
37 func IsProviderNotFound(err error) bool {
38 _, ok := err.(*errProviderNotFound)
42 // IsServiceNotProvided returns true only if the given error is a "service not provided"
43 // error. This allows callers to recognize this particular error condition
44 // as distinct from operational errors such as poor network connectivity.
45 func IsServiceNotProvided(err error) bool {
46 _, ok := err.(*disco.ErrServiceNotProvided)
50 // ServiceUnreachableError Registry service is unreachable
51 type ServiceUnreachableError struct {
55 func (e *ServiceUnreachableError) Error() string {
59 // IsServiceUnreachable returns true if the registry/discovery service was unreachable
60 func IsServiceUnreachable(err error) bool {
61 _, ok := err.(*ServiceUnreachableError)