Skip to content

Display entire exception chain in error templates - #942

Merged
giuscris merged 1 commit into
2.xfrom
feature/display-exception-chain
Aug 26, 2026
Merged

Display entire exception chain in error templates#942
giuscris merged 1 commit into
2.xfrom
feature/display-exception-chain

Conversation

@giuscris

@giuscris giuscris commented Aug 26, 2026

Copy link
Copy Markdown
Member

This pull request improves error handling and debugging in both the core and panel error controllers, enhances the display of exception traces in debug views, and updates the styling for error debug details. The main changes include support for chained exceptions in error logs and debug UIs, a refactor of how stack traces are resolved and passed to views, and visual refinements for better readability.

Error handling and exception trace improvements:

  • Updated both formwork/src/Controllers/ErrorsController.php and formwork/src/Panel/Controllers/ErrorsController.php to log chained exceptions (using getPrevious()) in a format similar to PHP's native exception handler, and refactored the getTrace method to handle null values and return an empty array if needed. The stack trace is now passed as a callable (traceResolver) instead of a precomputed array, enabling support for multiple exceptions in the view. [1] [2] [3] [4]

Debug view enhancements:

  • Updated error debug views in formwork/views/errors/partials/debug.php and panel/views/errors/error.php to display all exceptions in a chain (using a while loop over getPrevious()), and to use the new traceResolver for resolving stack traces per exception. [1] [2] [3]

Styling improvements:

  • Adjusted the margin and background color for .error-debug-details in both the core and panel stylesheets for better visual consistency and readability, including improved dark mode support. [1] [2]
  • Slightly tweaked the dark color scheme background for code dumps in formwork/src/Debug/CodeDumper.php for better contrast.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances Formwork鈥檚 error debugging experience by rendering full exception chains (including previous exceptions) in both the core and panel error pages, and by refactoring how stack traces are resolved so each exception can display its own trace.

Changes:

  • Update error templates to iterate through exception chains and render a per-exception stack trace via a traceResolver callable.
  • Refactor controllers to pass a traceResolver callable instead of a precomputed stackTrace array, and adjust trace extraction to accept null.
  • Improve error debug UI styling (spacing + dark mode tweaks) and adjust dark-mode code block background color.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
panel/views/errors/error.php Renders full exception chains and resolves traces dynamically in the panel error UI.
panel/src/scss/components/_errors.scss Tweaks spacing and adds dark-scheme background for debug details.
formwork/views/errors/partials/header.php Adjusts debug details spacing in the core error header styles.
formwork/views/errors/partials/debug.php Renders full exception chains and resolves traces dynamically in the core debug partial.
formwork/src/Panel/Controllers/ErrorsController.php Passes traceResolver, updates trace extraction signature, and logs chained exceptions.
formwork/src/Debug/CodeDumper.php Adjusts dark-mode code background color.
formwork/src/Controllers/ErrorsController.php Passes traceResolver, updates trace extraction signature, and logs chained exceptions.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread formwork/src/Controllers/ErrorsController.php
Comment thread formwork/src/Panel/Controllers/ErrorsController.php
Comment thread panel/views/errors/error.php
Comment thread formwork/views/errors/partials/debug.php
@giuscris
giuscris merged commit 5a95f45 into 2.x Aug 26, 2026
3 checks passed
@giuscris
giuscris deleted the feature/display-exception-chain branch August 26, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants