Skip to content

Commit 1949a6d

Browse files
Handling processing failure and timeouts
1 parent eafb934 commit 1949a6d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cli/cli.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ func (c *Cli) process(cl client.Client, mode string, lang string, langVer string
449449

450450
if c.isCompleted(status) {
451451
break
452+
} else if c.isFailed(status) {
453+
return nil, fmt.Errorf("the task processing has failed")
452454
}
453455

454456
select {
@@ -510,6 +512,11 @@ func (c *Cli) isCompleted(status *client.GetProcessStatusResponse) bool {
510512
return status.Status == client.StatusCompleted
511513
}
512514

515+
func (c *Cli) isFailed(status *client.GetProcessStatusResponse) bool {
516+
return status.Status == client.StatusFailed ||
517+
status.Status == client.StatusTimedOut
518+
}
519+
513520
func (c *Cli) backoff(retry int) {
514521
retry -= nonExponentRetries
515522
if retry < 0 {

0 commit comments

Comments
 (0)