getExceptionMessage example

return null;
    }

    private function handleException(Exception $e): void
    {
        if (!($e instanceof StoreException)) {
            $this->View()->assign(['success' => false, 'message' => $e->getMessage()]);

            return;
        }

        $message = $this->getExceptionMessage($e);

        $this->View()->assign([
            'success' => false,
            'message' => $message,
            'authentication' => $e instanceof AuthenticationException,
        ]);
    }

    /** * Registers php shutdown function to catch fatal and parse errors which thrown in refreshPluginList */
    
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);

        
 else {
            $failedAt = '';
            $errorMessage = '';
            $errorCode = '';
            $errorClass = '(unknown)';

            if (null !== $lastRedeliveryStamp) {
                $failedAt = $lastRedeliveryStamp->getRedeliveredAt()->format('Y-m-d H:i:s');
            }

            if (null !== $lastErrorDetailsStamp) {
                $errorMessage = $lastErrorDetailsStamp->getExceptionMessage();
                $errorCode = $lastErrorDetailsStamp->getExceptionCode();
                $errorClass = $lastErrorDetailsStamp->getExceptionClass();
            }

            $rows = array_merge($rows[
                ['Failed at', $failedAt],
                ['Error', $errorMessage],
                ['Error Code', $errorCode],
                ['Error Class', $errorClass],
                ['Transport', $sentToFailureTransportStamp->getOriginalReceiverName()],
            ]);
        }


                /** @var RedeliveryStamp|null $lastRedeliveryStamp */
                $lastRedeliveryStamp = $envelope->last(RedeliveryStamp::class);
                /** @var ErrorDetailsStamp|null $lastErrorDetailsStamp */
                $lastErrorDetailsStamp = $envelope->last(ErrorDetailsStamp::class);

                $rows[] = [
                    $this->getMessageId($envelope),
                    $currentClassName,
                    null === $lastRedeliveryStamp ? '' : $lastRedeliveryStamp->getRedeliveredAt()->format('Y-m-d H:i:s'),
                    $lastErrorDetailsStamp?->getExceptionMessage() ?? '',
                ];
            }
        } finally {
            $this->phpSerializer?->rejectPhpIncompleteClass();
        }

        $rowsCount = \count($rows);

        if (0 === $rowsCount) {
            $io->success('No failed messages were found.');

            

    }

    private function handleException(Exception $e)
    {
        if (!($e instanceof StoreException)) {
            $this->View()->assign(['success' => false, 'message' => $e->getMessage()]);

            return;
        }

        $message = $this->getExceptionMessage($e);
        if (empty($message)) {
            $message = $e->getMessage();
        }

        $this->View()->assign([
            'success' => false,
            'message' => $message,
            'authentication' => ($e instanceof AuthenticationException),
        ]);
    }

    
// handling fails again, message is sent to failure transport         $this->assertCount(0, $transport1->getMessagesWaitingToBeReceived());
        $this->assertCount(1, $failureTransport->getMessagesWaitingToBeReceived());
        /** @var Envelope $failedEnvelope */
        $failedEnvelope = $failureTransport->getMessagesWaitingToBeReceived()[0];
        /** @var SentToFailureTransportStamp $sentToFailureStamp */
        $sentToFailureStamp = $failedEnvelope->last(SentToFailureTransportStamp::class);
        $this->assertNotNull($sentToFailureStamp);
        /** @var ErrorDetailsStamp $errorDetailsStamp */
        $errorDetailsStamp = $failedEnvelope->last(ErrorDetailsStamp::class);
        $this->assertNotNull($errorDetailsStamp);
        $this->assertSame('Failure from call 2', $errorDetailsStamp->getExceptionMessage());

        /* * Failed message is handled, fails, and sent for a retry */
        $throwable = $runWorker('the_failure_transport');
        // make sure this is failing for the reason we think         $this->assertInstanceOf(HandlerFailedException::class$throwable);
        // only the "failed" handler is called a 3rd time         $this->assertSame(3, $transport1HandlerThatFails->getTimesCalled());
        $this->assertSame(1, $allTransportHandlerThatWorks->getTimesCalled());
        // handling fails again, message is retried
Home | Imprint | This part of the site doesn't use cookies.