Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli new commands: Improve error handling for non-project contexts #468

Open
cmf-moreira opened this issue Jan 23, 2025 · 0 comments
Open
Assignees

Comments

@cmf-moreira
Copy link
Contributor

Hi,

I want to report an inconsistency in the behaviour of some @criticalmanufacturing/cli new commands.

Current Behavior:

Certain cmf/cli new commands, such as cmf new html and cmf new business, throw an exception when executed outside of an initialized project folder. This exception includes a stack trace but lacks a user-friendly error message.

For example:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
     System.NullReferenceException: Object reference not set to an instance of an object.
       at void Cmf.CLI.Commands.New.BusinessCommand.Execute(IDirectoryInfo workingDir, string version, bool addApplicationVersionAssembly) in /home/runner/work/cli/cli/cmf-cli/Commands/new/BusinessCommand.cs:61

In contrast, the cmf new data command, provide a clear and actionable error message when used outside of a project:

This command needs to run inside a project. Run 'cmf init' to create a new project.

Proposed Improvement:

I propose that all cmf/cli new commands be reviewed to ensure they provide a consistent and user-friendly error message when executed outside of an initialized project folder. This message should ideally be similar to the one provided by cmf new data.

Benefits:

  • Improved user experience by providing clear and actionable error messages.
  • Reduced debugging time for users encountering these errors.

Kind Regards,

João Moreira

@cmf-moreira cmf-moreira changed the title Protec cli new commands: Improve error handling for non-project contexts Jan 23, 2025
@cmf-moreira cmf-moreira self-assigned this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant