Skip to content
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

Question: Add Exception Trace to Response Content #2304

Open
kirkbaly opened this issue Apr 14, 2021 · 0 comments
Open

Question: Add Exception Trace to Response Content #2304

kirkbaly opened this issue Apr 14, 2021 · 0 comments

Comments

@kirkbaly
Copy link

Is there a way to add full stack traces to the JSON response content for exceptions? I am using JMS Serializer and have played around with a few different options but I haven't found a reliable way that doesn't rely on the internal classes of FOSRestBundle but also maintains the status code and message mapping that is being performed in \FOS\RestBundle\Serializer\Normalizer\FlattenExceptionHandler.

The cleanest way to do this without changes to FlattenExceptionHandler would be to implement a JMS Serializer post_serializer event, but JMS Serializer doesn't fire the post_serializer event for custom handlers.

One option would be to add a new configuration option for this. Something like:

fos_rest:
    exception:
        show_trace: "%kernel.debug%"

This would be easy enough to implement in \FOS\RestBundle\Serializer\Normalizer\FlattenExceptionHandler and \FOS\RestBundle\Serializer\Normalizer\FlattenExceptionNormalizer.

Any assistance or thoughts would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant