Skip to content

Commit

Permalink
feat(errors): better error handling and feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xizhao committed Jan 29, 2018
1 parent b0ec539 commit 732038c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/fossa/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func setDefaultValues(c Config) (Config, error) {
if len(c.CLI.Locator) == 0 {
repo, err := git.PlainOpen(".")
if err != nil {
return c, err
return c, errors.New("no revision found in working directory; try running in a git repo or passing a locator")
}

project := c.CLI.Project
Expand Down
6 changes: 5 additions & 1 deletion cmd/fossa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func BootstrapCmd(c *cli.Context) error {
config, err := ReadConfig(c.String("config"))
log.Logger.Debugf("Configuration: %+v\n", config)
if err != nil {
return err
log.Logger.Fatalf("error initializing: %s", err)
}

// Set configuration via flags.
Expand Down Expand Up @@ -164,6 +164,10 @@ func BootstrapCmd(c *cli.Context) error {
func DefaultCmd(c *cli.Context) {
config := context.config

if len(config.Analyze.Modules) == 0 {
log.Logger.Fatalf("no modules specified for analysis")
}

// Run the spinner only when we don't rely on stdout
s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)

Expand Down

0 comments on commit 732038c

Please sign in to comment.