Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
qinxx108 committed Feb 2, 2023
1 parent 205b802 commit 25b9227
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions notify/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ func (r *Retrier) Check(statusCode int, body io.Reader) (bool, error) {
type ErrorWithReason struct {
Err error

// The reason of the failure.
Reason Reason
}

Expand All @@ -228,7 +227,7 @@ func (e *ErrorWithReason) Error() string {
return e.Err.Error()
}

// Reason is the failure reason
// Reason is the failure reason.
type Reason int

const (
Expand All @@ -250,12 +249,10 @@ func (s Reason) String() string {
}
}

// possibleFailureReasonCategory is a list of possible failure reason
// possibleFailureReasonCategory is a list of possible failure reason.
var possibleFailureReasonCategory = []string{DefaultReason.String(), ClientErrorReason.String(), ServerErrorReason.String()}

// GetFailureReasonFromStatusCode return the reason for failure request
// the status starts with 4 will return 4xx and starts with 5 will return 5xx
// other than 4xx and 5xx input status will return an 5xx.
// GetFailureReasonFromStatusCode returns the reason for the failure based on the status code provided.
func GetFailureReasonFromStatusCode(statusCode int) Reason {
if statusCode/100 == 4 {
return ClientErrorReason
Expand Down

0 comments on commit 25b9227

Please sign in to comment.