Format errors better for CLI (#552)

* Start making errors easier to read for Table based CLI UI.

* Add TODO about reporting "update_mask" related errors.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-10-06 14:08:49 -07:00
1 parent d6c6aea179
commit 6c6fb7a4d0
22 files changed
+90 -63

No files matched your search

@@ -175,8 +175,8 @@ func (c *Command) Run(args []string) int {
plural = "auth methods"
}
if err != nil {
if api.AsServerError(err) != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing %s on %s: %s", c.Func, plural, err.Error()))
if apiErr := api.AsServerError(err); apiErr != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing %s on %s: %s", c.Func, plural, base.PrintApiError(apiErr)))
return 1
}
c.UI.Error(fmt.Sprintf("Error trying to %s %s: %s", c.Func, plural, err.Error()))