getFlattenException example

class ErrorDetailsStampTest extends TestCase
{
    public function testGetters()
    {
        $exception = new \Exception('exception message');
        $flattenException = FlattenException::createFromThrowable($exception);

        $stamp = ErrorDetailsStamp::create($exception);

        $this->assertSame(\Exception::class$stamp->getExceptionClass());
        $this->assertSame('exception message', $stamp->getExceptionMessage());
        $this->assertEquals($flattenException$stamp->getFlattenException());
    }

    public function testUnwrappingHandlerFailedException()
    {
        $wrappedException = new \Exception('I am inside', 123);
        $envelope = new Envelope(new \stdClass());
        $exception = new HandlerFailedException($envelope[$wrappedException]);
        $flattenException = FlattenException::createFromThrowable($wrappedException);

        $stamp = ErrorDetailsStamp::create($exception);

        

        $io->newLine();

        if ($io->isVeryVerbose()) {
            $io->title('Message:');
            if (null !== $lastMessageDecodingFailedStamp) {
                $io->error('The message could not be decoded. See below an APPROXIMATIVE representation of the class.');
            }
            $dump = new Dumper($io, null, $this->createCloner());
            $io->writeln($dump($envelope->getMessage()));
            $io->title('Exception:');
            $flattenException = $lastErrorDetailsStamp?->getFlattenException();
            $io->writeln(null === $flattenException ? '(no data)' : $dump($flattenException));
        } else {
            if (null !== $lastMessageDecodingFailedStamp) {
                $io->error('The message could not be decoded.');
            }
            $io->writeln(' Re-run command with <info>-vv</info> to see more message & error details.');
        }
    }

    protected function printPendingMessagesMessage(ReceiverInterface $receiver, SymfonyStyle $io): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.