Skip to content

Display proper error message when shift cannot find shift.json #32

@sparshadotel

Description

@sparshadotel

Commands:

shift-cli add env
shift deploy dev

Debug Output

panic: Error reading file.: open /tmp/shift.json: no such file or directory

goroutine 1 [running]:
github.com/leapfrogtechnology/shift/core/services/storage.failOnError(...)
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/core/services/storage/storage.go:14
github.com/leapfrogtechnology/shift/core/services/storage.Read(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/core/services/storage/storage.go:24 +0x23b
github.com/leapfrogtechnology/shift/cli/internals/env.Run()
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/cli/internals/env/env.go:26 +0x37
github.com/leapfrogtechnology/shift/cli/cmd.AddEnv(...)
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/cli/cmd/env.go:9
github.com/leapfrogtechnology/shift/cli/cmd.Initialize.func4(0xc0000b86e0, 0x0, 0xc0001eebd0)
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/cli/cmd/cmd.go:57 +0x21
github.com/urfave/cli.HandleAction(0xa8f4c0, 0xbac578, 0xc0000b86e0, 0xc0000b86e0, 0x0)
	/home/sparsha/go/src/github.com/urfave/cli/app.go:523 +0xbe
github.com/urfave/cli.Command.Run(0xb78136, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/sparsha/go/src/github.com/urfave/cli/command.go:174 +0x521
github.com/urfave/cli.(*App).RunAsSubcommand(0xc00022a380, 0xc0000b8420, 0x0, 0x0)
	/home/sparsha/go/src/github.com/urfave/cli/app.go:404 +0x889
github.com/urfave/cli.Command.startApp(0xb780be, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/sparsha/go/src/github.com/urfave/cli/command.go:329 +0x84f
github.com/urfave/cli.Command.Run(0xb780be, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/sparsha/go/src/github.com/urfave/cli/command.go:102 +0x9c4
github.com/urfave/cli.(*App).Run(0xc00022a1c0, 0xc0000b2040, 0x4, 0x4, 0x0, 0x0)
	/home/sparsha/go/src/github.com/urfave/cli/app.go:276 +0x71c
github.com/leapfrogtechnology/shift/cli/cmd.Initialize(0xc000215f58, 0xbac4f8, 0x0)
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/cli/cmd/cmd.go:66 +0x20b
main.main()
	/home/sparsha/go/src/github.com/leapfrogtechnology/shift/shift.go:17 +0x8e

Expected Behaviour

shift.json is not present in this directory.
Please add shift.json or initialize with shift-cli setup

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