github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/provider/lxd/errors.go (about) 1 // Copyright 2018 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package lxd 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 }