Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
80.00% covered (warning)
80.00%
8 / 10
DelayedMessageHandlingException
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
3.07
80.00% covered (warning)
80.00%
8 / 10
 __construct
0.00% covered (danger)
0.00%
0 / 1
2.01
88.89% covered (warning)
88.89%
8 / 9
 getExceptions
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Component\Messenger\Exception;
/**
 * When handling queued messages from {@link DispatchAfterCurrentBusMiddleware},
 * some handlers caused an exception. This exception contains all those handler exceptions.
 *
 * @author Tobias Nyholm <tobias.nyholm@gmail.com>
 */
class DelayedMessageHandlingException extends RuntimeException
{
    private $exceptions;
    public function __construct(array $exceptions)
    {
        $exceptionMessages = implode(", \n", array_map(
            function (\Throwable $e) {
                return \get_class($e).': '.$e->getMessage();
            },
            $exceptions
        ));
        if (1 === \count($exceptions)) {
            $message = sprintf("A delayed message handler threw an exception: \n\n%s", $exceptionMessages);
        } else {
            $message = sprintf("Some delayed message handlers threw an exception: \n\n%s", $exceptionMessages);
        }
        $this->exceptions = $exceptions;
        parent::__construct($message, 0, $exceptions[0]);
    }
    public function getExceptions(): array
    {
        return $this->exceptions;
    }
}