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

Render trace in JsonErrorRenderer #3242

Closed
maiermic opened this issue Dec 5, 2022 · 4 comments
Closed

Render trace in JsonErrorRenderer #3242

maiermic opened this issue Dec 5, 2022 · 4 comments

Comments

@maiermic
Copy link

maiermic commented Dec 5, 2022

In Slim 3, the trace of an exception is rendered in JSON response (see Slim/Handlers/PhpError::renderJsonErrorMessage). In Slim 4, the field trace is missing (see Slim/Error/Renderers/JsonErrorRenderer:: formatExceptionFragment). Was this change intentional? Otherwise, please add the field trace again.

@l0gicgate
Copy link
Member

You can make your own error renderer or extend an existing renderer.

@maiermic
Copy link
Author

maiermic commented Dec 5, 2022

Thanks, that's what I did as a workaround. The easiest way would be to extend JsonErrorRenderer and override the method formatExceptionFragment, but it is private. Hence, you have to copy the code and modify it.

Anyhow, it is inconsistent if JsonErrorRenderer does not include the trace, but others do, see:

@l0gicgate
Copy link
Member

I'm closing this as resolved.

@maiermic
Copy link
Author

@l0gicgate I wouldn't consider this as resolved. See my question:

Was this change intentional?

I still consider it as an accidental breaking change, i.e. a bug. All other renderers still render the trace. Only JsonErrorRenderer is missing it after the upgrade from Slim 3 to 4. I have not found any explanation for this change. Not in the commit messages, the issues or the changelog.

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

2 participants