Beispiel #1
0
 public function canRetry(RetryContextInterface $context)
 {
     $e = $context->getLastException();
     return (!$e || $this->shouldRetryForException($e)) && $context->getRetryCount() < $this->maxAttempts;
 }
 public function testRetryCount()
 {
     $this->policy->registerException($this->context, new \RuntimeException('foo'));
     $this->assertEquals(1, $this->context->getRetryCount());
     $this->assertEquals('foo', $this->context->getLastException()->getMessage());
 }
 /**
  * @inheritdoc
  */
 public function registerException(RetryContextInterface $context, \Exception $exception)
 {
     $context->registerException($exception);
 }