Skip to content

All CLI errors are silent #225

@jakebailey

Description

@jakebailey

I've noticed that all CLI utility errors are silent. For example, if you try to create a migration, but you did something wrong, there will be no output and no files created.

I tracked this down to how the CLI is run. You do:

newApp().Run(os.Args)

But according to the docs for the cli lib version you're using, errors returned by cli actions must implement cli.ExitCoder to be printed, but the errors returned by errors.New definitely don't.

To fix, you can either:

  • Switch to using the (technically deprecated) RunAndExitOnError function
  • Print the error returned by Run and exit with a non-zero code
  • Implement cli.ExitCoder for the errors (or wrap just as they escape the action function)

Out of those, I'd probably pick the first, since you've pinned the urfave cli library at v1 anyway.

If you'd prefer, I can send a PR, but it's a pretty small change that you could probably make more quickly yourselves. 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions