Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getExceptionClass example
$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
(
)
]
,
]
)
;
}
use
Symfony\Component\Serializer\Serializer
as
SymfonySerializer;
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
)
;