update
This commit is contained in:
58
projects/priceservice/vendor/symfony/messenger/Exception/DelayedMessageHandlingException.php
vendored
Normal file
58
projects/priceservice/vendor/symfony/messenger/Exception/DelayedMessageHandlingException.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
|
||||
/**
|
||||
* 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 implements WrappedExceptionsInterface, EnvelopeAwareExceptionInterface
|
||||
{
|
||||
use EnvelopeAwareExceptionTrait;
|
||||
use WrappedExceptionsTrait;
|
||||
|
||||
private array $exceptions;
|
||||
|
||||
public function __construct(array $exceptions, ?Envelope $envelope = null)
|
||||
{
|
||||
$this->envelope = $envelope;
|
||||
|
||||
$exceptionMessages = implode(", \n", array_map(
|
||||
fn (\Throwable $e) => $e::class.': '.$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[array_key_first($exceptions)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.4, use {@see self::getWrappedExceptions()} instead
|
||||
*/
|
||||
public function getExceptions(): array
|
||||
{
|
||||
trigger_deprecation('symfony/messenger', '6.4', 'The "%s()" method is deprecated, use "%s::getWrappedExceptions()" instead.', __METHOD__, self::class);
|
||||
|
||||
return $this->exceptions;
|
||||
}
|
||||
}
|
||||
22
projects/priceservice/vendor/symfony/messenger/Exception/EnvelopeAwareExceptionInterface.php
vendored
Normal file
22
projects/priceservice/vendor/symfony/messenger/Exception/EnvelopeAwareExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
interface EnvelopeAwareExceptionInterface
|
||||
{
|
||||
public function getEnvelope(): ?Envelope;
|
||||
}
|
||||
27
projects/priceservice/vendor/symfony/messenger/Exception/EnvelopeAwareExceptionTrait.php
vendored
Normal file
27
projects/priceservice/vendor/symfony/messenger/Exception/EnvelopeAwareExceptionTrait.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait EnvelopeAwareExceptionTrait
|
||||
{
|
||||
private ?Envelope $envelope = null;
|
||||
|
||||
public function getEnvelope(): ?Envelope
|
||||
{
|
||||
return $this->envelope;
|
||||
}
|
||||
}
|
||||
21
projects/priceservice/vendor/symfony/messenger/Exception/ExceptionInterface.php
vendored
Normal file
21
projects/priceservice/vendor/symfony/messenger/Exception/ExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Base Messenger component's exception.
|
||||
*
|
||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||
*/
|
||||
interface ExceptionInterface extends \Throwable
|
||||
{
|
||||
}
|
||||
75
projects/priceservice/vendor/symfony/messenger/Exception/HandlerFailedException.php
vendored
Normal file
75
projects/priceservice/vendor/symfony/messenger/Exception/HandlerFailedException.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
|
||||
class HandlerFailedException extends RuntimeException implements WrappedExceptionsInterface, EnvelopeAwareExceptionInterface
|
||||
{
|
||||
use WrappedExceptionsTrait;
|
||||
|
||||
private Envelope $envelope;
|
||||
|
||||
/**
|
||||
* @param \Throwable[] $exceptions The name of the handler should be given as key
|
||||
*/
|
||||
public function __construct(Envelope $envelope, array $exceptions)
|
||||
{
|
||||
$firstFailure = current($exceptions);
|
||||
|
||||
$message = sprintf('Handling "%s" failed: ', $envelope->getMessage()::class);
|
||||
|
||||
parent::__construct(
|
||||
$message.(1 === \count($exceptions)
|
||||
? $firstFailure->getMessage()
|
||||
: sprintf('%d handlers failed. First failure is: %s', \count($exceptions), $firstFailure->getMessage())
|
||||
),
|
||||
(int) $firstFailure->getCode(),
|
||||
$firstFailure
|
||||
);
|
||||
|
||||
$this->envelope = $envelope;
|
||||
$this->exceptions = $exceptions;
|
||||
}
|
||||
|
||||
public function getEnvelope(): Envelope
|
||||
{
|
||||
return $this->envelope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.4, use {@see self::getWrappedExceptions()} instead
|
||||
*
|
||||
* @return \Throwable[]
|
||||
*/
|
||||
public function getNestedExceptions(): array
|
||||
{
|
||||
trigger_deprecation('symfony/messenger', '6.4', 'The "%s()" method is deprecated, use "%s::getWrappedExceptions()" instead.', __METHOD__, self::class);
|
||||
|
||||
return array_values($this->exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 6.4, use {@see self::getWrappedExceptions()} instead
|
||||
*/
|
||||
public function getNestedExceptionOfClass(string $exceptionClassName): array
|
||||
{
|
||||
trigger_deprecation('symfony/messenger', '6.4', 'The "%s()" method is deprecated, use "%s::getWrappedExceptions()" instead.', __METHOD__, self::class);
|
||||
|
||||
return array_values(
|
||||
array_filter(
|
||||
$this->exceptions,
|
||||
fn ($exception) => is_a($exception, $exceptionClassName)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/InvalidArgumentException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/InvalidArgumentException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||
*/
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/LogicException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/LogicException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Roland Franssen <franssen.roland@gmail.com>
|
||||
*/
|
||||
class LogicException extends \LogicException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/MessageDecodingFailedException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/MessageDecodingFailedException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Thrown when a message cannot be decoded in a serializer.
|
||||
*/
|
||||
class MessageDecodingFailedException extends InvalidArgumentException
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/NoHandlerForMessageException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/NoHandlerForMessageException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||
*/
|
||||
class NoHandlerForMessageException extends LogicException
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/NoSenderForMessageException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/NoSenderForMessageException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Jérémy Reynaud <jeremy@reynaud.io>
|
||||
*/
|
||||
class NoSenderForMessageException extends LogicException
|
||||
{
|
||||
}
|
||||
24
projects/priceservice/vendor/symfony/messenger/Exception/RecoverableExceptionInterface.php
vendored
Normal file
24
projects/priceservice/vendor/symfony/messenger/Exception/RecoverableExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Marker interface for exceptions to indicate that handling a message should have worked.
|
||||
*
|
||||
* If something goes wrong while handling a message that's received from a transport
|
||||
* and the message should be retried, a handler can throw such an exception.
|
||||
*
|
||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||
*/
|
||||
interface RecoverableExceptionInterface extends \Throwable
|
||||
{
|
||||
}
|
||||
21
projects/priceservice/vendor/symfony/messenger/Exception/RecoverableMessageHandlingException.php
vendored
Normal file
21
projects/priceservice/vendor/symfony/messenger/Exception/RecoverableMessageHandlingException.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* A concrete implementation of RecoverableExceptionInterface that can be used directly.
|
||||
*
|
||||
* @author Frederic Bouchery <frederic@bouchery.fr>
|
||||
*/
|
||||
class RecoverableMessageHandlingException extends RuntimeException implements RecoverableExceptionInterface
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/RejectRedeliveredMessageException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/RejectRedeliveredMessageException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RejectRedeliveredMessageException extends RuntimeException
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/RuntimeException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/RuntimeException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
23
projects/priceservice/vendor/symfony/messenger/Exception/StopWorkerException.php
vendored
Normal file
23
projects/priceservice/vendor/symfony/messenger/Exception/StopWorkerException.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class StopWorkerException extends RuntimeException implements StopWorkerExceptionInterface
|
||||
{
|
||||
public function __construct(string $message = 'Worker should stop.', ?\Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, 0, $previous);
|
||||
}
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/StopWorkerExceptionInterface.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/StopWorkerExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
interface StopWorkerExceptionInterface extends \Throwable
|
||||
{
|
||||
}
|
||||
19
projects/priceservice/vendor/symfony/messenger/Exception/TransportException.php
vendored
Normal file
19
projects/priceservice/vendor/symfony/messenger/Exception/TransportException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Eric Masoero <em@studeal.fr>
|
||||
*/
|
||||
class TransportException extends RuntimeException
|
||||
{
|
||||
}
|
||||
24
projects/priceservice/vendor/symfony/messenger/Exception/UnrecoverableExceptionInterface.php
vendored
Normal file
24
projects/priceservice/vendor/symfony/messenger/Exception/UnrecoverableExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Marker interface for exceptions to indicate that handling a message will continue to fail.
|
||||
*
|
||||
* If something goes wrong while handling a message that's received from a transport
|
||||
* and the message should not be retried, a handler can throw such an exception.
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface UnrecoverableExceptionInterface extends \Throwable
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* A concrete implementation of UnrecoverableExceptionInterface that can be used directly.
|
||||
*
|
||||
* @author Frederic Bouchery <frederic@bouchery.fr>
|
||||
*/
|
||||
class UnrecoverableMessageHandlingException extends RuntimeException implements UnrecoverableExceptionInterface
|
||||
{
|
||||
}
|
||||
48
projects/priceservice/vendor/symfony/messenger/Exception/ValidationFailedException.php
vendored
Normal file
48
projects/priceservice/vendor/symfony/messenger/Exception/ValidationFailedException.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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;
|
||||
|
||||
use Symfony\Component\Messenger\Envelope;
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
|
||||
/**
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class ValidationFailedException extends RuntimeException implements EnvelopeAwareExceptionInterface
|
||||
{
|
||||
use EnvelopeAwareExceptionTrait;
|
||||
|
||||
private ConstraintViolationListInterface $violations;
|
||||
private object $violatingMessage;
|
||||
|
||||
public function __construct(object $violatingMessage, ConstraintViolationListInterface $violations, ?Envelope $envelope = null)
|
||||
{
|
||||
$this->violatingMessage = $violatingMessage;
|
||||
$this->violations = $violations;
|
||||
$this->envelope = $envelope;
|
||||
|
||||
parent::__construct(sprintf('Message of type "%s" failed validation.', $this->violatingMessage::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getViolatingMessage()
|
||||
{
|
||||
return $this->violatingMessage;
|
||||
}
|
||||
|
||||
public function getViolations(): ConstraintViolationListInterface
|
||||
{
|
||||
return $this->violations;
|
||||
}
|
||||
}
|
||||
25
projects/priceservice/vendor/symfony/messenger/Exception/WrappedExceptionsInterface.php
vendored
Normal file
25
projects/priceservice/vendor/symfony/messenger/Exception/WrappedExceptionsInterface.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Exception that holds multiple exceptions thrown by one or more handlers and/or messages.
|
||||
*
|
||||
* @author Jeroen <https://github.com/Jeroeny>
|
||||
*/
|
||||
interface WrappedExceptionsInterface
|
||||
{
|
||||
/**
|
||||
* @return \Throwable[]
|
||||
*/
|
||||
public function getWrappedExceptions(?string $class = null, bool $recursive = false): array;
|
||||
}
|
||||
56
projects/priceservice/vendor/symfony/messenger/Exception/WrappedExceptionsTrait.php
vendored
Normal file
56
projects/priceservice/vendor/symfony/messenger/Exception/WrappedExceptionsTrait.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* @author Jeroen <https://github.com/Jeroeny>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
trait WrappedExceptionsTrait
|
||||
{
|
||||
private array $exceptions;
|
||||
|
||||
/**
|
||||
* @return \Throwable[]
|
||||
*/
|
||||
public function getWrappedExceptions(?string $class = null, bool $recursive = false): array
|
||||
{
|
||||
return $this->getWrappedExceptionsRecursively($class, $recursive, $this->exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<\Throwable>|null $class
|
||||
* @param iterable<\Throwable> $exceptions
|
||||
*
|
||||
* @return \Throwable[]
|
||||
*/
|
||||
private function getWrappedExceptionsRecursively(?string $class, bool $recursive, iterable $exceptions): array
|
||||
{
|
||||
$unwrapped = [];
|
||||
foreach ($exceptions as $key => $exception) {
|
||||
if ($recursive && $exception instanceof WrappedExceptionsInterface) {
|
||||
$unwrapped[] = $this->getWrappedExceptionsRecursively($class, $recursive, $exception->getWrappedExceptions());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($class && !is_a($exception, $class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$unwrapped[] = [$key => $exception];
|
||||
}
|
||||
|
||||
return array_merge(...$unwrapped);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user