Skip to content

Commit

Permalink
Merge pull request exercism#873 from avegner/add-missing-error-checks
Browse files Browse the repository at this point in the history
Make all errors in cmd package checked
  • Loading branch information
Katrina Owen authored Aug 18, 2019
2 parents 4ad01b1 + 96a994c commit a51b6ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ func runDownload(cfg config.Config, flags *pflag.FlagSet, args []string) error {
// TODO: handle collisions
path := sf.relativePath()
dir := filepath.Join(metadata.Dir, filepath.Dir(path))
os.MkdirAll(dir, os.FileMode(0755))
if err = os.MkdirAll(dir, os.FileMode(0755)); err != nil {
return err
}

f, err := os.Create(filepath.Join(metadata.Dir, path))
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Pass the path to the directory that contains the solution you want to see on the
if err != nil {
return err
}
browser.Open(metadata.URL)
return nil
return browser.Open(metadata.URL)
},
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/troubleshoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ func (status *Status) compile() (string, error) {
}

var bb bytes.Buffer
t.Execute(&bb, status)
if err = t.Execute(&bb, status); err != nil {
return "", err
}
return bb.String(), nil
}

Expand Down

0 comments on commit a51b6ec

Please sign in to comment.