Skip to content

Commit 57836b3

Browse files
authored
Improve error message when func invoke is run outside function directory (#3018)
* Improve error message f or func invoke Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com> * fix the linting error --------- Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
1 parent 2f22a0b commit 57836b3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cmd/invoke.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func runInvoke(cmd *cobra.Command, _ []string, newClient ClientFactory) (err err
154154
return err
155155
}
156156
if !f.Initialized() {
157-
return fn.NewErrNotInitialized(f.Root)
157+
return fmt.Errorf("no function found in current directory.\nYou need to be inside a function directory to invoke it.\n\nTry this:\n func create --language go myfunction Create a new function\n cd myfunction Go into the function directory\n func invoke Now you can invoke it\n\nOr if you have an existing function:\n cd path/to/your/function Go to your function directory\n func invoke Invoke the function")
158158
}
159159

160160
// Client instance from env vars, flags, args and user prompts (if --confirm)

0 commit comments

Comments
 (0)