Skip to content

Commit

Permalink
Throw exception on half open fail
Browse files Browse the repository at this point in the history
  • Loading branch information
stfndamjanovic committed Jan 27, 2024
1 parent 7162847 commit 9eec825
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/StateHandlers/HalfOpenStateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Stfn\CircuitBreaker\StateHandlers;

use Stfn\CircuitBreaker\Exceptions\CircuitOpenException;

class HalfOpenStateHandler extends StateHandler
{
/**
Expand All @@ -25,5 +27,7 @@ public function onSucess()
public function onFailure(\Exception $exception)
{
$this->breaker->openCircuit();

throw CircuitOpenException::make($this->breaker->getName());
}
}

0 comments on commit 9eec825

Please sign in to comment.