mirror of https://github.com/databricks/cli.git
Improved error message when no .databrickscfg (#1223)
## Changes Fixes #1060
This commit is contained in:
parent
4ac1c1655b
commit
5309e0fc2a
|
@ -189,7 +189,7 @@ func AskForWorkspaceProfile(ctx context.Context) (string, error) {
|
||||||
}
|
}
|
||||||
switch len(profiles) {
|
switch len(profiles) {
|
||||||
case 0:
|
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:
|
case 1:
|
||||||
return profiles[0].Name, nil
|
return profiles[0].Name, nil
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ func AskForAccountProfile(ctx context.Context) (string, error) {
|
||||||
}
|
}
|
||||||
switch len(profiles) {
|
switch len(profiles) {
|
||||||
case 0:
|
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:
|
case 1:
|
||||||
return profiles[0].Name, nil
|
return profiles[0].Name, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ func Get(ctx context.Context) (*config.File, error) {
|
||||||
configFile, err := config.LoadFile(path)
|
configFile, err := config.LoadFile(path)
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
// downstreams depend on ErrNoConfiguration. TODO: expose this error through SDK
|
// 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 {
|
} else if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue