feat(fenom): Name the source in compile errors - #25
Merged
Conversation
Ibochkarev
marked this pull request as ready for review
September 2, 2026 02:46
Fenom logged a content hash as the template name, so a syntax error could not be traced to a chunk, file, or resource. Keep the same cache keys and add a readable label, excerpt, and cache path. Fixes #21
Assert labels, excerpts, MODX-tag hints, and that the Fenom cache name stays a hash or binding/id.
Ibochkarev
force-pushed
the
feat/fenom-error-logs
branch
from
September 2, 2026 06:25
7b75a59 to
f972045
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #25 +/- ##
============================================
+ Coverage 16.07% 20.74% +4.67%
- Complexity 1060 1171 +111
============================================
Files 14 15 +1
Lines 2774 2964 +190
============================================
+ Hits 446 615 +169
- Misses 2328 2349 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
One label/format owner; CoreTools and Parser pass origin and resource facts only. Drop duplicate builders and happy-path label work.
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.
What
Fenom put an md5 of the template source into compile errors. A line like
in ee058690d9fd7413748b95b0960e006b line 6did not say which chunk, file, or resource failed.That hash is Fenom's internal template name, not a MODX snippet include cache file. Cache keys stay on the hash. The log adds a readable label beside it.
ErrorLogowns the label and the full message. Compile and runtime failures go through it. CoreTools and Parser pass facts only (origin,elementName,sourceFile, plus resource id/uri/context/template). Fenom builds the label in the catch path, not on every successful render.The MODX error log and
&showLogget the element or page, the current resource when useful, a few source lines, and a compiled-file path when that file exists. If the broken line still has[[+...]], the log suggests the Fenom placeholder.Cache keys,
getStore('fenom'), compiled template names, andsource($name, $content)stay the same. Parser still hashes trimmed content.Before:
After, for a DB chunk:
After, for Fenom on the page (
pdotools_fenom_parser):@FILElogsfile:core/elements/chunks/item.tpl.@INLINElogsinline. Withpdotools_fenom_save_on_errors, a compile error also listssource dump: core/cache/pdotools/error/{name}.The old compiled PHP dump at INFO is gone. Use the excerpt or the save-on-errors dump.
Why
A syntax error in a chunk or on a page could not be traced from the MODX log. Changing the hash would break Fenom's compile cache, so the label stays next to it.
Fixes #21