Skip to content

Make FlattenExceptionHandler/FlattenExceptionNormalizer extensible #2372

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

Open
bilel-noomene opened this issue Jun 29, 2022 · 1 comment
Open

Comments

@bilel-noomene
Copy link

Hello,
I need to change the error return format keeping the behavior of the bundle. I see it's pretty hard to do since FlattenExceptionHandler is internal and its attributes are private.
Why is this class not extensible?

@kevinpapst
Copy link
Contributor

@goetas I would like to raise the question as well: can we remove the @internal flag from the FlattenExceptionHandler class? I can obviously suppress IDE/PHPStan errors, but I wonder why this class has it in the first place, it seems feature complete and its logic is hard to replicate in project scope.

I am using it in my own exception listener in order to translate user facing validation errors, especially the serializeToJson() method like so: https://github.com/kimai/kimai/blob/main/src/API/Serializer/ValidationFailedExceptionErrorHandler.php

Any feedback is highly 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

2 participants