Skip to content

Commit

Permalink
fix(wfr): correcly check error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jian Zeng committed Nov 25, 2020
1 parent acc9509 commit f857f44
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/workflow/workflowrun/operator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package workflowrun

import (
stderr "errors"
"fmt"
"os"
"reflect"
Expand Down Expand Up @@ -361,7 +362,11 @@ func (o *operator) OverallStatus() (*v1alpha1.Status, error) {
}

func isExceededQuotaError(err error) bool {
return errors.IsForbidden(err) && strings.Contains(err.Error(), "exceeded quota:")
if status := errors.APIStatus(nil); stderr.As(err, &status) {
s := status.Status()
return s.Reason == metav1.StatusReasonForbidden && strings.Contains(s.Message, "exceeded quota:")
}
return false
}

// Reconcile finds next stages in the workflow to run and resolve WorkflowRun's overall status.
Expand Down

0 comments on commit f857f44

Please sign in to comment.