diff --git a/v2/gobreaker.go b/v2/gobreaker.go index 2f77a93..c0382d1 100644 --- a/v2/gobreaker.go +++ b/v2/gobreaker.go @@ -226,11 +226,10 @@ func (cb *CircuitBreaker[T]) Counts() Counts { // If a panic occurs in the request, the CircuitBreaker handles it as an error // and causes the same panic again. func (cb *CircuitBreaker[T]) Execute(req func() (T, error)) (T, error) { - var zero T - generation, err := cb.beforeRequest() if err != nil { - return zero, err + var defaultValue T + return defaultValue, err } defer func() {