Skip to content

Commit 4c37de9

Browse files
committed
improve error message for func run making it more beginner friendly
1 parent ec7ff7e commit 4c37de9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func runRun(cmd *cobra.Command, newClient ClientFactory) (err error) {
160160
return
161161
}
162162
if !f.Initialized() {
163-
return fn.NewErrNotInitialized(f.Root)
163+
return fmt.Errorf("no function found in current directory.\nYou need to be inside a function directory to run it.\n\nTry this:\n func create --language go myfunction Create a new function\n cd myfunction Go into the function directory\n func run Run the function locally\n\nOr if you have an existing function:\n cd path/to/your/function Go to your function directory\n func run Run the function locally")
164164
}
165165

166166
if err = cfg.Validate(cmd, f); err != nil {

0 commit comments

Comments
 (0)