FOSRestBundle
FOSRestBundle copied to clipboard
Make FlattenExceptionHandler/FlattenExceptionNormalizer extensible
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?
@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!