Skip to content

Commit

Permalink
chore: use idiomatic error check
Browse files Browse the repository at this point in the history
  • Loading branch information
KianYang-Lee committed Jun 24, 2024
1 parent 1f03dae commit a6be774
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middleware/request/circuit_breaker.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package request

import (
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -43,9 +44,10 @@ func NewCircuitBreakerMiddleware(threshold uint32, period time.Duration) func(ne
return struct{}{}, nil
})
if err != nil {
if err == gobreaker.ErrOpenState {
if errors.Is(err, gobreaker.ErrOpenState) {
return ErrCircuitBreakerOpen
}

return err
}

Expand Down

0 comments on commit a6be774

Please sign in to comment.