I have two projects:
Example controller:
/**
* @Route("/test")
*/
public function index()
{
throw new \DomainException('an exception');
}
In the first project I get a proper response: {"code":500,"message":"an exception"}
However in the second one an exception is thrown:
(2/2)聽RuntimeExceptionResources are not supported in serialized data. Path: Symfony\Component\HttpKernel\Log\Logger -> Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher -> ContainerOJzRqJn\srcDevDebugProjectContainer -> App\Auth\Controller\AuthController -> DomainException
--
in聽GraphNavigator.php聽(line 161)
I think in the first project FOS Rest Bundle used some kind of fallback when JMS could not serialize the exception (just my assumption). How to get the second project working properly?
The same as my last comment: https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1790
For Reference: https://github.com/schmittjoh/JMSSerializerBundle/issues/626
This should be solved by https://github.com/FriendsOfSymfony/FOSRestBundle/pull/1805 (at least it works now on my side) @kbkk maybe you can test that commit so that @xabbuh can get the PR merged
Here the Composer Version Constraint:
"friendsofsymfony/rest-bundle": "dev-master#dcd5add5153af7e479e97a233efa6fdcd0164879 as 2.3",
@juliusstoerrle it did the trick. Why isn't it merged yet?
@kbkk Not sure, maybe @xabbuh wanted more feedback?
Tests just don't pass yet as there are some more issues with the current implementation and I didn't find the time to finish it yet.
Thanks for providing that issue! I also experienced the same. Fixed by switching to the dev version in composer.json:
"friendsofsymfony/rest-bundle": "2.3.x-dev"
So imho the issue here can be closed as the issue is merged allready into master branch.
Most helpful comment
Tests just don't pass yet as there are some more issues with the current implementation and I didn't find the time to finish it yet.