func icon indicating copy to clipboard operation
func copied to clipboard

Bug: Wrong error message when running func commands if the function is not initialized

Open Leo6Leo opened this issue 10 months ago • 3 comments

Issue Summary:

When executing the commands func deploy, func run, and func build without first initializing a function (missing func.yaml file due to not running func create or func init), the error handling leads to an unclear message. This occurs even if the commands are typed correctly.

Current Behavior:

Attempting to run any of the above commands without initializing a function results in a misleading error message related to registry validation:

func build -b=s2i -v
A registry for function images is required. For example, 'docker.io/tigerteam'.
X Sorry, your reply was invalid: invalid registry ["quay.io/user-abc"]: name required
? Registry for function images:

The error message should clearly indicate that the function has not been initialized and provide guidance on the necessary steps to proceed.

Proposed Solution:

Improve the error message to more accurately reflect the issue and guide the user. Suggested new error message:

Error: No function has been initialized in the current directory ({path}). Please initialize a function by running either:
- func init --language <your language>
- func create <function name> --language <language>

Leo6Leo avatar Apr 24 '24 04:04 Leo6Leo

Thanks @Leo6Leo,

This does look like a logic problem. There should be a different error there.

I've added this to the roadmap

lkingland avatar Apr 25 '24 01:04 lkingland

I would like to work on this issue!

EraKin575 avatar Jun 17 '24 08:06 EraKin575

@EraKin575 hello, are you still working on this issue?

gauron99 avatar Aug 12 '24 14:08 gauron99