Return error code in case of formatting failure.

This commit is contained in:
Artur Mullakhmetov 2020-03-26 18:24:21 +03:00
parent eab5b81d91
commit 845b9c23fe
14 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatToken(t)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -137,6 +137,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatPolicy(p)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -69,6 +69,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatPolicyList(policies)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -91,6 +91,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatPolicy(p)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -168,6 +168,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatPolicy(p)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -123,6 +123,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatRole(r)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -69,6 +69,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatRoleList(roles)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -103,6 +103,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatRole(r)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -208,6 +208,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatRole(r)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -84,6 +84,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatToken(t)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -154,6 +154,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatToken(t)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -68,6 +68,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatTokenList(tokens)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -97,6 +97,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatToken(t)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)

View File

@ -284,6 +284,7 @@ func (c *cmd) Run(args []string) int {
out, err := formatter.FormatToken(t)
if err != nil {
c.UI.Error(err.Error())
return 1
}
if out != "" {
c.UI.Info(out)