diff --git a/cli/cli.go b/cli/cli.go index dc623fc..ccfc991 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -449,6 +449,8 @@ func (c *Cli) process(cl client.Client, mode string, lang string, langVer string if c.isCompleted(status) { break + } else if c.isFailed(status) { + return nil, fmt.Errorf("the task processing has failed") } select { @@ -510,6 +512,11 @@ func (c *Cli) isCompleted(status *client.GetProcessStatusResponse) bool { return status.Status == client.StatusCompleted } +func (c *Cli) isFailed(status *client.GetProcessStatusResponse) bool { + return status.Status == client.StatusFailed || + status.Status == client.StatusTimedOut +} + func (c *Cli) backoff(retry int) { retry -= nonExponentRetries if retry < 0 {