chore: improve error message when no func on path (#1739)

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek 2023-05-15 20:44:09 +02:00 committed by GitHub
parent 2269aa0f91
commit 62105aa857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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
//

View File

@ -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)