Issue Feature Closed

#106153Make it easy to copy exception stacktrace

Christian Weiske 02/11/25, 13:07 updated 03/31/26, 09:00

Description

The default debug exception handler not only shows the exception type, message and stacktrace, but also the code at the stack locations.
This makes it hard to copy the stacktrace into a issue or ticket, because the code snippets need to be removed manually.

It would be nice if the exception page HTML would contain the clean stack trace as HTML comment, so that we can copy it from there.

——

Other exception handlers

The default laravel exception handler facade/ignition does so: Each exception page begins with a HTML comment very early in the response:

<!doctype html>
<html class="theme-light">
<!--
Exception:  in file app/Http/Controllers/GraphQLController.php on line 37

#0 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\GraphQLController-&gt;processUrl()
#1 vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller-&gt;callAction()
[...]
#58 {main}
-->
<head>

Reviews 1

Files 11

History 1122

  1. Garvin Hicking commented and changed attached Screenshot 2025-02-12 at 18.46.48.png attached Screenshot 2025-02-12 at 18.46.56.png <span data-processor="relativetime" data-value="2025-02-12T17:47:54+00:00" > 02/12/25, 17:47 </span>

    This is a nice idea. I made a little different implementation that offers a javascript functionality to toggle between the views. What do you think?

    Screenshots:

  2. Christian Weiske commented <span data-processor="relativetime" data-value="2025-03-02T07:51:01+00:00" > 03/02/25, 07:51 </span>

    I think all that functionality is overkill. I only need something to obtain the stack trace in a way I can paste into bug reports.

    Copying single lines, the HTML version, the minimal HTML version does not help.
    Even the plain text version is too verbose to be pasted into bug reports.

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2025-03-02T09:20:36+00:00" > 03/02/25, 09:20 </span>

    I spent the whole saturday on this, maybe we can try to productively improve this.

    Its not copy a single line, but to copy the filename&line number!

    Copying the HTML could help for ticket systems that have some basic formatting, or HTML mails to colleagues, or archiving.

    And for TYPO3 bug reports here you would actually copy everything. We need all the verbose information. You would copy the full HTML and attach a HTML file here.

    What’s not good about the plain text copy, how would you expect the output to be? Create an example with a few stack items please.

    And you can ignore all the copy buttons if you use your mouse to cooy/extract the portions you want…?

  4. Christian Weiske commented <span data-processor="relativetime" data-value="2025-03-05T09:04:01+00:00" > 03/05/25, 09:04 </span>

    I already included an example stack trace in the issue description.

    Here is another example plain text stack trace from symfony which is pretty dense and does not contain too many newlines:

    Symfony\Component\Debug\Exception\ClassNotFoundException:
    Attempted to load class "Twig_Extensions_Extension_Debug" from the global namespace.
    Did you forget a "use" statement?
    
      at app/cache/dev/ContainerS5mwhr5/appDevDebugProjectContainer.php:876
      at ContainerS5mwhr5\appDevDebugProjectContainer->getTwigService()
         (app/cache/dev/ContainerS5mwhr5/getAssetic_AssetManagerService.php:8)
      at require('/var/www/timetracker/app/cache/dev/ContainerS5mwhr5/getAssetic_AssetManagerService.php')
         (app/cache/dev/ContainerS5mwhr5/appDevDebugProjectContainer.php:732)
      at ContainerS5mwhr5\appDevDebugProjectContainer->load()
         (app/cache/dev/ContainerS5mwhr5/getRouting_LoaderService.php:19)
  5. Sybille Peters commented and changed attached typo3_exception.png <span data-processor="relativetime" data-value="2026-02-01T10:13:55+00:00" > 02/01/26, 10:13 </span>

    My 2c on issue:

    • I did not know what stack trace you mean, I assume you mean stacktrace in Frontend (or also in BE)?
    • Adding “how to reproduce” might be awesome, e.g.

    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

    typo3_exception.png

    ——

    Personally, I usually take the exception trace from the file log, then I have to convert \\n to \n, replace my sitename, shorten it and can upload it as file.

    For having helpful issues, I think it would definitely help to have stack traces in some cases.

    But, you could upload the entire dump as file. Usually, the first 2 or 3 items might suffice to copy them as “pre” in issue.

    If people are not testing with the latest version, having the source-code lines might actually be helpful. (though it would be better if they did, but they might be using latest release, not git-based).

  6. Garvin Hicking commented and changed attached Screenshot 2026-02-03 at 22.20.59.png attached Screenshot 2026-02-03 at 22.21.19.png attached Screenshot 2026-02-03 at 22.21.37.png attached Screenshot 2026-02-03 at 22.21.53.png attached Screenshot 2026-02-03 at 22.22.30.png attached Screenshot 2026-02-03 at 22.22.42.png attached Screenshot 2026-02-03 at 22.22.51.png attached Screenshot 2026-02-03 at 22.23.10.png <span data-processor="relativetime" data-value="2026-02-03T21:27:15+00:00" > 02/03/26, 21:27 </span>

    Here are some more screenshots. Also a comparison of https://github.com/dkd-dobberkau/enhanced-error-handler is included.

  7. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-02-11T13:10:08+00:00" > 02/11/26, 13:10 </span>

    Applied in changeset commit:359cda320081b94187083a239a48c21495197aa3.