Skip to content

Commit df15242

Browse files
Return ErrCannotConfigureDefault when DefaulCredentials cannot determine the default auth type. (#1226)
## What changes are proposed in this pull request? This PR adds changes `DefaultCredentials` to return `ErrCannotConfigureDefault` when it cannot determine the default auth type. The goal is to make it easier for clients (such as the Databricks CLI) to differentiate auth errors from config errors. ## How is this tested? N/A NO_CHANGELOG=true
1 parent 616a9b4 commit df15242

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

config/auth_default.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import (
1111

1212
const authDocURL = "https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication"
1313

14+
// ErrCannotConfigureDefault indicates that the DefaultCredentials strategy was
15+
// unable to configure the default credentials.
16+
var ErrCannotConfigureDefault = fmt.Errorf("cannot configure default credentials, please check %s to configure credentials for your preferred authentication method", authDocURL)
17+
1418
type DefaultCredentials struct {
1519
name string
1620
}
@@ -83,7 +87,7 @@ func (c *DefaultCredentials) Configure(ctx context.Context, cfg *Config) (creden
8387
return cp, nil
8488
}
8589

86-
return nil, fmt.Errorf("cannot configure default credentials, please check %s to configure credentials for your preferred authentication method", authDocURL)
90+
return nil, ErrCannotConfigureDefault
8791
}
8892

8993
func githubOIDC(cfg *Config) CredentialsStrategy {

0 commit comments

Comments
 (0)