FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

Make FlattenExceptionHandler/FlattenExceptionNormalizer extensible

Open bilel-noomene opened this issue 3 years ago • 1 comments

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?

bilel-noomene avatar Jun 29 '22 08:06 bilel-noomene

@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!

kevinpapst avatar May 06 '25 18:05 kevinpapst