Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[ErrorRenderer] Refactor and delegate serializing responsibility to the Serializer component #34288
By default, the ErrorRenderer component will host only the HTML+JS error page, delegating the serialization of other formats to the Serializer component (if installed & serializer config is enabled). This will simplify the usage and integration with other third-party packages like API-Platform and FOSRestBundle.
…onent (nicolas-grekas, yceruto) This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] merge and remove the ErrorRenderer component | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR supersedes #34288. Here is what it does: - Merge the `ErrorRenderer` component into `ErrorHandler` - Add `ErrorRendererInterface::render(\Throwable $e): FlattenException` and refactor error renderers around it. - Add `FlattenException::setAsString()` to make the previous possible. - Add `CliErrorRenderer` to render error on the CLI too. This means `VarDumper` is now a required dependency of `ErrorHandler`. This paves the way to use it also for rendering HTML - the logic there is much more advanced than what `HtmlErrorRenderer` provides and ever should provide. - Make `BufferingLogger` map its collected logs to `error_log()` if they are not emptied before. - Remove some classes that are not needed anymore (`ErrorRenderer`, `ErrorRendererPass`, `HtmlErrorRendererInterface`) - Simplified the logic in `Debug::enable()` - nobody uses its arguments - Fix a few issues found meanwhile. With these changes, the component can be used standalone. One is now able to require only it, register it either with either `ErrorHandler::register()` or `Debug::enable()` and profit. Commits ------- d1bf1ca [ErrorHandler] help finish the PR 6c9157b [ErrorHandler] merge and remove the ErrorRenderer component