Display entire exception chain in error templates - #942
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
traceResolvercallable. - Refactor controllers to pass a
traceResolvercallable instead of a precomputedstackTracearray, and adjust trace extraction to acceptnull. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
formwork/src/Controllers/ErrorsController.phpandformwork/src/Panel/Controllers/ErrorsController.phpto log chained exceptions (usinggetPrevious()) in a format similar to PHP's native exception handler, and refactored thegetTracemethod to handlenullvalues 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:
formwork/views/errors/partials/debug.phpandpanel/views/errors/error.phpto display all exceptions in a chain (using awhileloop overgetPrevious()), and to use the newtraceResolverfor resolving stack traces per exception. [1] [2] [3]Styling improvements:
.error-debug-detailsin both the core and panel stylesheets for better visual consistency and readability, including improved dark mode support. [1] [2]formwork/src/Debug/CodeDumper.phpfor better contrast.