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

+2 -2
View File
@@ -456,8 +456,8 @@ func (c *Command) Run(args []string) (retCode int) {
sar, err := targetClient.AuthorizeSession(c.Context, c.flagTargetId, opts...)
if err != nil {
if api.AsServerError(err) != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing authorize-session against target: %s", err.Error()))
if apiErr := api.AsServerError(err); apiErr != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing authorize-session against target: %s", base.PrintApiError(apiErr)))
return 1
}
c.UI.Error(fmt.Sprintf("Error trying to authorize a session against target: %s", err.Error()))