Improved error message when no .databrickscfg (#1223)

## Changes
Fixes #1060
This commit is contained in:
Andrew Nester 2024-02-21 15:15:26 +01:00 committed by GitHub
parent 4ac1c1655b
commit 5309e0fc2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -189,7 +189,7 @@ func AskForWorkspaceProfile(ctx context.Context) (string, error) {
}
switch len(profiles) {
case 0:
return "", fmt.Errorf("%s does not contain workspace profiles; please create one first", path)
return "", fmt.Errorf("%s does not contain workspace profiles; please create one by running 'databricks configure'", path)
case 1:
return profiles[0].Name, nil
}
@ -222,7 +222,7 @@ func AskForAccountProfile(ctx context.Context) (string, error) {
}
switch len(profiles) {
case 0:
return "", fmt.Errorf("%s does not contain account profiles; please create one first", path)
return "", fmt.Errorf("%s does not contain account profiles; please create one by running 'databricks configure'", path)
case 1:
return profiles[0].Name, nil
}

View File

@ -95,7 +95,7 @@ func Get(ctx context.Context) (*config.File, error) {
configFile, err := config.LoadFile(path)
if errors.Is(err, fs.ErrNotExist) {
// downstreams depend on ErrNoConfiguration. TODO: expose this error through SDK
return nil, fmt.Errorf("%w at %s; please create one first", ErrNoConfiguration, path)
return nil, fmt.Errorf("%w at %s; please create one by running 'databricks configure'", ErrNoConfiguration, path)
} else if err != nil {
return nil, err
}