github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/provider/openstack/errors.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package openstack
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  	gooseerrors "gopkg.in/goose.v2/errors"
     9  )
    10  
    11  // IsAuthorisationFailure determines if the given error has an authorisation failure.
    12  func IsAuthorisationFailure(err error) bool {
    13  	// This should cover most cases.
    14  	if gooseerrors.IsUnauthorised(errors.Cause(err)) {
    15  		return true
    16  	}
    17  	return false
    18  }