Skip to content

Defining a command without cmd or valid imports defined causes panic #50

@frankcarey

Description

@frankcarey

This should fail more gracefully with a helpful error message.

Example files:

version: v2
commands:
  example:
    usage: This doesn't have a command defined.
version: v2
commands:
  example:
    usage: 'cmd' is misspelled as 'dmc'
    dmc: echo "test"
version: v2
commands:
  example:
    usage: This doesn't have an import where the file actually exists.
    imports:
      - file-not-exists.yml
version: v2
commands:
  example:
    usage: This has 'imports' misspelled as 'import'
    import:
      - import-exists.yml

Panic Error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x74918]

goroutine 1 [running]:
panic(0x17d220, 0xc4200120b0)
	/usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:500 +0x1a1
github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli.Command.Run(0xc4200705a0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4200705c0, 0xf, 0x0, ...)
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli/command.go:131 +0x798
github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli.(*App).Run(0xc42009e120, 0xc420084060, 0x2, 0x2, 0x0, 0x0)
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli/app.go:175 +0xa35
main.main()
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/ahoy.go:379 +0xea

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