From 62105aa8579fd2ccd96dc206de498e23e3ded8d8 Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Mon, 15 May 2023 20:44:09 +0200 Subject: [PATCH] chore: improve error message when no func on path (#1739) Signed-off-by: Matej Vasek --- cmd/config.go | 2 +- cmd/delete.go | 2 +- cmd/describe.go | 2 +- cmd/invoke.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index a6fe37f4b..e579aa8c8 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -32,7 +32,7 @@ func (s standardLoaderSaver) Load(path string) (fn.Function, error) { return fn.Function{}, fmt.Errorf("failed to create new function (path: %q): %w", path, err) } if !f.Initialized() { - return fn.Function{}, fmt.Errorf("the given path '%v' does not contain an initialized function", path) + return fn.Function{}, fmt.Errorf("the given path '%v' does not contain an initialized function", f.Root) } return f, nil } diff --git a/cmd/delete.go b/cmd/delete.go index ef103fc55..9f3d1b911 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -80,7 +80,7 @@ func runDelete(cmd *cobra.Command, args []string, newClient ClientFactory) (err // Check if the function has been initialized if !function.Initialized() { - return fmt.Errorf("the given path '%v' does not contain an initialized function", cfg.Path) + return fmt.Errorf("the given path '%v' does not contain an initialized function", function.Root) } // If not provided, use the function's extant namespace diff --git a/cmd/describe.go b/cmd/describe.go index d4bddcd96..9ff1e627f 100644 --- a/cmd/describe.go +++ b/cmd/describe.go @@ -74,7 +74,7 @@ func runDescribe(cmd *cobra.Command, args []string, newClient ClientFactory) (er return } if !f.Initialized() { - return fmt.Errorf("the given path '%v' does not contain an initialized function.", cfg.Path) + return fmt.Errorf("the given path '%v' does not contain an initialized function.", f.Root) } // Use Function's Namespace with precedence // diff --git a/cmd/invoke.go b/cmd/invoke.go index 3f1f32dd0..a152cf17f 100644 --- a/cmd/invoke.go +++ b/cmd/invoke.go @@ -145,7 +145,7 @@ func runInvoke(cmd *cobra.Command, args []string, newClient ClientFactory) (err return } if !f.Initialized() { - return fmt.Errorf("'%v' does not contain an initialized function", cfg.Path) + return fmt.Errorf("'%v' does not contain an initialized function", f.Root) } // Client instance from env vars, flags, args and user prompts (if --confirm)