github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/provider/equinix/errors.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package equinix 5 6 import ( 7 "strings" 8 9 "github.com/juju/errors" 10 ) 11 12 // IsAuthorisationFailure determines if the given error has an authorisation failure. 13 func IsAuthorisationFailure(err error) bool { 14 if err == nil { 15 return false 16 } else if strings.Contains(errors.Cause(err).Error(), "not authorized") { 17 return true 18 } 19 return false 20 }