From c1fe2df94559fc1fcd96898dfaec9ed31a4ebf66 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Mon, 19 Feb 2024 13:15:40 +0100 Subject: [PATCH] Improved error message when no .databrickscfg --- cmd/root/auth.go | 4 ++-- libs/databrickscfg/profiles.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/root/auth.go b/cmd/root/auth.go index a2cdd04fe3..89c7641c54 100644 --- a/cmd/root/auth.go +++ b/cmd/root/auth.go @@ -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 } diff --git a/libs/databrickscfg/profiles.go b/libs/databrickscfg/profiles.go index c7bb271955..200ac9c879 100644 --- a/libs/databrickscfg/profiles.go +++ b/libs/databrickscfg/profiles.go @@ -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 }