createResponse() public method

Create the response for the given operation and exception.
public createResponse ( Tolerance\Operation\Operation $operation, Exception | Throwable $throwable ) : mixed
$operation Tolerance\Operation\Operation
$throwable Exception | Throwable
return mixed
 function it_returns_a_placeholder_response_if_it_fails(OperationRunner $decoratedRunner, Operation $operation, PlaceholderResponseResolver $placeholderResponseResolver)
 {
     $exception = new \Exception();
     $decoratedRunner->run($operation)->willThrow($exception);
     $placeholderResponseResolver->createResponse($operation, $exception)->shouldBeCalled()->willReturn('');
     $this->run($operation)->shouldBe('');
 }
 /**
  * {@inheritdoc}
  */
 public function run(Operation $operation)
 {
     try {
         return $this->decoratedRunner->run($operation);
     } catch (\Exception $e) {
         // Handled later
     } catch (\Throwable $e) {
         // Handled later
     }
     if (!$this->catcherVoter->shouldCatchThrowable($e)) {
         throw $e;
     }
     $placeholder = $this->placeholderResponseResolver->createResponse($operation, $e);
     if (null !== $this->logger) {
         $this->logger->warning('An operation exception was replaced by a placeholder', ['operation' => $operation, 'placeholder' => $placeholder]);
     }
     return $placeholder;
 }