Skip to content

Commit

Permalink
Fix probable bugs when unhandled errors (#1056)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Starr-Bochicchio <[email protected]>
  • Loading branch information
alexandear and andrewsomething authored Nov 1, 2021
1 parent bea5796 commit 58b08f3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 1 addition & 2 deletions commands/droplets.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,8 @@ func RunDropletCreate(c *CmdConfig) error {
return err
}
}
c.Display(item)

return nil
return c.Display(item)
}

// RunDropletTag adds a tag to a droplet.
Expand Down
10 changes: 8 additions & 2 deletions commands/firewalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ func extractInboundRules(s string) (rules []godo.InboundRule, err error) {
}
mr, _ := json.Marshal(rule)
ir := &godo.InboundRule{}
json.Unmarshal(mr, ir)
err = json.Unmarshal(mr, ir)
if err != nil {
return nil, err
}
rules = append(rules, *ir)
}

Expand All @@ -435,7 +438,10 @@ func extractOutboundRules(s string) (rules []godo.OutboundRule, err error) {
}
mr, _ := json.Marshal(rule)
or := &godo.OutboundRule{}
json.Unmarshal(mr, or)
err = json.Unmarshal(mr, or)
if err != nil {
return nil, err
}
rules = append(rules, *or)
}

Expand Down
5 changes: 4 additions & 1 deletion commands/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ func RunRegistryLogin(c *CmdConfig) error {
return err
}

cf.Save()
err = cf.Save()
if err != nil {
return err
}
}

return nil
Expand Down
5 changes: 4 additions & 1 deletion scripts/gen-yaml-docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ func writeDocs(cmd *cobra.Command, dir string) error {
defer f.Close()

// Call Cobra's GenYaml command, passing in the created file
doc.GenYaml(cmd, f)
err = doc.GenYaml(cmd, f)
if err != nil {
return err
}
// Append alias information to the standard YAML output
aliases := fmt.Sprintf("aliases: %s\n", strings.Join(cmd.Aliases, ", "))

Expand Down

0 comments on commit 58b08f3

Please sign in to comment.