Review main Merged

88201[FEATURE] Improve DebugExceptionHandler with clipboard functionality

Garvin Hicking CR +2 V +2 Hard +372 −3 updated 02/11/26, 13:19

Commit message

When using copy+paste for a stack trace, the long list of
actual file contents make the stack trace hard to read.

It is hard to forward stacktraces properly, so a foundation
for better extraction is needed so that we can properly
act on reported forge issues or other support channels,
without having to get into a feedback loop on how to get
to this data. Or to get screenshot reports that are
cut off.

A new footer section is added to allow a toggle between the
full stack trace (default) and a minimal stacktrace (without
file contents), performed dynamically via JavaScript.

The whole strack trace can directly be copied to the
clipboard. A fallback on clipboard failure reveals the
text representation.

Each file's path and line number can also be copied
to the clipboard, it will be relative to the projectPath.
This makes it easier to find the location
in IDEs and setups that use path mapping.

Screenshots provided in the issue. In comparison to
https://github.com/dkd-dobberkau/enhanced-error-handler
this patch aims to:

- have minimal impact of known visual layout of
  stack traces
- have minimum impact on the PHP side of the
  handler, solve most via JavaScript
- have no nested scrolling behavior
- provide the most important full export
  to help in triaging TYPO3 bug reports

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Matthias Vogel +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Matthias Vogel +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 3950

Show 1825 earlier messages
  1. Garvin Hicking uploaded patch set 1 02/12/25, 17:46

  2. core-ci voted on patch set 1 V +1 02/12/25, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74062

  3. Georg Ringer commented on patch set 1 02/12/25, 19:17

    DebugExceptionHandler.php:141

    nitpicking but IMHO that should be a button
  4. Garvin Hicking commented on patch set 1 02/12/25, 20:22

    DebugExceptionHandler.php:141 Reply

    Then it would need styling and probably an icon, and a wrapping form.... I thought it to be a bit bloaty. But let's see if anyone actualy likes this, happy to try ti change it then.
  5. Oliver Wand voted on patch set 1 CR +1 02/20/25, 08:38

  6. Andreas Kienast commented on patch set 1 CR -1 02/20/25, 10:40

    DebugExceptionHandler.php:427

    If it's not a button, let's not name it as such

    DebugExceptionHandler.php:427

    const

    DebugExceptionHandler.php:441

    Why do we need to return something here?
  7. Andreas Kienast commented on patch set 1 02/20/25, 10:45

    Another issue: you introduce inline JS again which we hardly removed in previous releases.

    DebugExceptionHandler.php:141 Reply

    You neither need an icon, nor a wrapping form element. IIRC this was true for XHTML back then.
  8. Garvin Hicking commented on patch set 1 02/20/25, 12:47

    Reply

    I figured because CSS was delivered inline, it was a conscious decission to let the stacktrace not have dependencies to other HTTP requests, even if it's static CSS/JS. Before I address the other (very valid) concerns, we should decide whether this is an option. I think the functionality is nice and it already could have a follow-up feature: https://forge.typo3.org/issues/106218 Then we could have a JS function that copies a file with line number into the clipboard. If you see no issues with creating and referencing a static JS file that is build via TS, I would prefer going that route. Another option would be to inline the statically built JS file with some "file_get_contents" type...?
  9. Garvin Hicking uploaded patch set 2 CR +1 V +1 03/01/25, 21:50

  10. Garvin Hicking commented on patch set 2 03/01/25, 21:56

    Reply

    I refactored this to a built TS->JS file, which is inlined (because URI resolving in the Exception handler would be bad).

    DebugExceptionHandler.php:141 Reply

    Refactored this (a lot).

    DebugExceptionHandler.php:427 Reply

    Done

    DebugExceptionHandler.php:427 Reply

    Done

    DebugExceptionHandler.php:441 Reply

    Done
  11. core-ci voted on patch set 2 V +1 03/01/25, 21:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74946

  12. Garvin Hicking rebased onto patch set 3 V +1 09/27/25, 19:08

  13. core-ci voted on patch set 3 V -1 09/27/25, 19:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85647

  14. Garvin Hicking rebased onto patch set 4 V -1 09/29/25, 16:09

  15. core-ci voted on patch set 4 V -1 09/29/25, 16:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85701

  16. Garvin Hicking uploaded patch set 5 V -1 11/26/25, 10:14

  17. core-ci voted on patch set 5 V +1 11/26/25, 10:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91010

  18. Sven Liebert commented on patch set 5 11/26/25, 10:56

    When copying the plaintext stack trace I have some unnecessary whitespaces in front of some lines. And IMO we should style the buttons a bit more than using default browser button (sorry they are very ugly :D) Thank you for this nice one.
  19. Garvin Hicking commented on patch set 5 11/26/25, 11:02

    Reply

    Yeah. This is honestly more a "proof of concept" and would need both JS and CSS love. Which my body and mind is unable to give :-D
  20. Simon Schaufelberger commented on patch set 5 11/27/25, 01:04

    No more video
  21. Garvin Hicking commented on patch set 5 11/27/25, 06:02

    Reply

    Yesh it's deleted, one has to check out the patch now 🙃
  22. Garvin Hicking rebased onto patch set 6 V +1 01/30/26, 15:14

  23. core-ci voted on patch set 6 V +1 01/30/26, 15:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94684

  24. Sybille Peters updated the commit message in patch set 7 V +1 02/01/26, 09:39

  25. core-ci voted on patch set 7 V +1 02/01/26, 09:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94755

  1. Sybille Peters commented on patch set 7 V -1 02/01/26, 10:03

    When I caused in exception in FE, I see little icons to copy /page, e.g. next to in /var/www/t3coredev14/typo3/sysext/frontend/Classes/Controller/ErrorController.php However, copy-paste does not work. Also, I get an exception in browser console: Uncaught TypeError: Cannot read properties of undefined (reading 'writeText') at HTMLButtonElement.<anonymous> (styleguide/?type=333:252:305) I tested this way: 1. Settings => Configuration Presets => Debug settings => "Debug" 2. In TypoScript : config.contentObjectExceptionHandler = 0 3. Cause exception, e.g. by invoking page with invalid type e.g. http://t3coredev14/styleguide/?type=333
  2. Garvin Hicking commented on patch set 7 02/01/26, 10:34

    Reply

    Some browsers (firefox iirc) do not allow to access the clipboard on non-https uris which you seem to use. I'll add a gating to that to inform about it, and a fallback to only show the next in that case. Thanks!
  3. Benni Mack commented on patch set 7 02/01/26, 11:05

  4. Garvin Hicking updated the commit message in patch set 8 V +1 02/01/26, 11:15

  5. core-ci voted on patch set 8 V +1 02/01/26, 11:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94758

  6. Garvin Hicking commented on patch set 8 02/01/26, 11:50

    Reply

    @benni@typo3.org I think we need this in the core. It's a feature for us supporters triagers. We often get bad or no stacktraces. I would not want to tell people to install an extension, it needs to work out of the box. But I could talk to dkd how they feel about migrating parts of it to the core then, do you agree?
  7. Garvin Hicking commented on patch set 8 02/01/26, 12:44

    Reply

    I got in touch with Olivier. He supports to join forces and combine the advantages his patch has into this one (giving credit of course). I'll work on that to propose an improved version of this patch, which should also improve the visuals. I firmly believe we need this to reduce friction in supporting TYPO3's stability and quality with better feedback.
  8. Garvin Hicking uploaded patch set 9 V +1 02/03/26, 21:32

  9. Garvin Hicking commented on patch set 9 02/03/26, 21:35

    Reply

    Optimized the plaintext now, and also aligned the button styling a bit more to TYPO3 current CSS. Also I've contacted @andy@pixelde.su and kindly asked for his help on improving the JS/CSS. :)

    Reply

    A fallback is now available.

    Reply

    I now slimmed the buttons a bit down, did some more minor styling, added a fallback when the clipboard copying fails, added some brief instructions, shortened the bottom section instructions, optimized the plaintext export and icons, and added a feature ReST file.
  10. core-ci voted on patch set 9 V +1 02/03/26, 21:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94946

  11. Matthias Vogel commented on patch set 9 02/10/26, 12:44

    I think it would be better to put it at the top where everyone can easily see it.

    debug-exception-handler-service.ts:79

    Can we only copy the relative path from the project folder? Most developers use DDEV or Docker with directory mounting/mapping. The absolute path that PHP uses and the absolute path that the IDE uses can differ.
  12. Garvin Hicking commented on patch set 9 02/10/26, 14:49

    Reply

    I think it would push down the iformation too much. I want to see the first 1/2 stacktrace boxes before other info. To me even the docs link is too disturbing. That's why I added a quickjump to the bottom... ?

    debug-exception-handler-service.ts:79 Reply

    Hm that would mean it needs access to some data that we can not access because of possible errors. The debug handler needs to have zero dependencies to other Environment:: classes or so. I think the user has to do that replacement, or how would you proceed? If there's a way I'm open for it.
  13. Matthias Vogel uploaded patch set 10 V +1 02/11/26, 08:46

  14. Matthias Vogel commented on patch set 10 02/11/26, 08:46

    Reply

    Done

    debug-exception-handler-service.ts:79 Reply

    Done
  15. Matthias Vogel voted on patch set 10 CR +1 V +1 02/11/26, 08:46

  16. core-ci voted on patch set 10 V +1 02/11/26, 08:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95605

  17. Garvin Hicking commented on patch set 10 02/11/26, 09:37

    Reply

    Done
    Hang on, we're on it and neeed to adjust for a case for exception without codes.
  18. Matthias Vogel uploaded patch set 11 CR +1 V +1 02/11/26, 09:53

  19. core-ci voted on patch set 11 V +1 02/11/26, 10:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95607

  20. Matthias Vogel voted on patch set 11 CR +1 V +1 02/11/26, 10:04

  21. Georg Ringer voted on patch set 11 CR +1 V +1 02/11/26, 12:45

  22. Garvin Hicking commented on patch set 11 CR +2 V +2 02/11/26, 13:08

    Reply

    Done
    Thanks Mathias and everyone else who helped to improve this, I think the solution is much better now. If anyone has issues with this, I would say we can iterate on it. This one's been on the stove for a long time now and it seems I can't motivate more people to chew on it :-D
  23. Garvin Hicking merged patch set 12 02/11/26, 13:08

  24. Josua Vogel commented on patch set 12 02/11/26, 13:15

    debug-exception-handler-service.ts:82

    Don´t forget to remove this ;)
  25. Garvin Hicking commented on patch set 12 02/11/26, 13:19

    debug-exception-handler-service.ts:82 Reply Unresolved

    Gah, thanks. Guess that's one reason for a followup now. :-D