github.com/magodo/terraform@v0.11.12-beta1/registry/errors.go (about) 1 package registry 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/registry/regsrc" 7 ) 8 9 type errModuleNotFound struct { 10 addr *regsrc.Module 11 } 12 13 func (e *errModuleNotFound) Error() string { 14 return fmt.Sprintf("module %s not found", e.addr) 15 } 16 17 // IsModuleNotFound returns true only if the given error is a "module not found" 18 // error. This allows callers to recognize this particular error condition 19 // as distinct from operational errors such as poor network connectivity. 20 func IsModuleNotFound(err error) bool { 21 _, ok := err.(*errModuleNotFound) 22 return ok 23 }