New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscribing Handler not used (FOSRestBundle: ExceptionHandler) #626
Comments
Are you using a "custom" exception ? (that maybe has a property of type |
I guess my issue is partially related to this. With sf4 and jms bundle ^2.3 I get the serialization error with Doctrine exceptions (which didn't happen before). $serializer = \JMS\Serializer\SerializerBuilder::create()->build();
$ex = new \Doctrine\DBAL\Exception\UniqueConstraintViolationException(
'',
new \Doctrine\DBAL\Driver\Mysqli\MysqliException('', null)
);
$serializer->serialize($ex, 'json'); |
if the exception contains a resource, you have to take care of serializing (or excluding) it |
My point is the test case above works in a sf3.3 project with jms bundle 2.2 without any additional configuration. Would you care to explain how to get this working with jms 2.3? |
Can it be that some other library got updated?
…On 9 Dec 2017 00:15, "Jakub Kisielewski" ***@***.***> wrote:
My point is the test case above works in a sf3.3 project with jms bundle
^2.2 without any additional configuration. Would you care to explain how to
achieve this with jms ^2.3?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#626 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAvaJ1tQI-Wc0qiPDDFeI-mB9-_5sMrWks5s-cMbgaJpZM4Q0uru>
.
|
I am sorry for the trouble, the test case is wrong. I think it is an issue with FOS Rest Bundle. Seems like in the working project it falls back to Symfony Serializer but not in the new one. I should start an issue on FOS Rest Bundle. |
Hey, I had started an Issue over there already about this topic (FriendsOfSymfony/FOSRestBundle#1790 (comment)) . The reason why I opened this Issue here is because the Handler from the Rest Bundle seems to be registered correctly. |
@goetas Sorry for not responding to:
Yes the exception has a property of that type (its not a custom exception, but one from the sf framework), but the Serialization Handler is supposed to remove that. |
"Serialization Handler" ? which one? |
Well my bad, when changing from SF4 Rcs to the 4.0 release I also changed the fos/rest version which resulted in not pulling some changes from an open pull request @xabbuh made. I changed that back and now it seems to work fine (hope it stays like that). |
Hey,
since upgrading I do get the "Resources not allowed in seralized data" error. This happens to me when serializing an exception via the ExceptionController in the FOSRestBundle. The Bundle registers a Handler for the
\Exception
Class which formats the exception and throws out all the resources...The Handler registers as:
[ 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, 'format' => 'json', 'type' => \Exception::class, 'method' => 'serializeToJson', ]
ExceptionHandler::getSubscribingMethods() is actually being called and the handler gets registered but not called during serialization.
I actually also had problems with my very own handlers when setting the type in the handler to
\SomeObject::class
. Somehow it did not use the Handler then so I'm using strings there and configure the properties with Annotations, but that not possible here.The text was updated successfully, but these errors were encountered: