Timeline for How can I return a templated response from an Exception Event subscriber?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 14, 2023 at 14:42 | history | edited | leymannx | CC BY-SA 4.0 |
Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.
|
Jan 14, 2023 at 14:15 | answer | added | 4uk4 | timeline score: 2 | |
Jan 14, 2023 at 10:45 | comment | added | 4uk4 | This is not the only API change because of Symfony. I find the Symfony exception handling far more capable. Core provides HTML exception subscribers for 4xx exceptions and fall backs to plain text error messages in case of 5xx exceptions. It would be no problem to add a custom event subscribers (what the OP is trying to do) to catch 5xx exceptions and set an HTML response. | |
Jan 13, 2023 at 19:52 | comment | added | Jaypan | Well, the D7 functionality in core was not properly upgraded to D8 (and still hasn't been). It's a core API that is meant to handle this issue. | |
Jan 13, 2023 at 19:36 | comment | added | 4uk4 | This issue is about the Drupal 7 perspective on fatal errors. Catching an exception in an Symfony event subscriber is not a fatal error and you are in full control to set an HTML response instead of a plain-text message. | |
Jan 13, 2023 at 18:16 | comment | added | Jaypan | There was a method for this in D7, but it was broken between D7 and D8, and has still not been repaired. You can use the patch from this issue however: drupal.org/project/drupal/issues/2720109 | |
Jan 13, 2023 at 18:12 | history | asked | user1414202 | CC BY-SA 4.0 |