-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
This issue is automatically created based on existing pull request: #36836: feat: more informative error message on xml validation errors
Description (*)
This PR adds more informative output to the existing error message displayed, when there is invalid XML configuration.
For example if there is invalid layout.xml the standard error message displayed to a developer would be something like:
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'arguments': This element is not expected.
Line: 1471
This isn't very helpful as the line number refers to the XML after it has been merged, making it pretty impossible to determine the file that caused the issue.
This PR changes the output to
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'arguments': This element is not expected.
Line: 1471
The xml was:
1466: <argument name="show_category" xsi:type="boolean">true</argument>
1467: </arguments>
1468: </block>
1469: <referenceBlock name="product_view_detail" remove="true"/>
1470: <block name="abc.gtm.product_view_detail" class="ABC\GoogleTagManager\Block\Detail" template="ABC_GoogleTagManager::detailproduct.phtml"/>
1471: <arguments>
1472: <argument name="show_category" xsi:type="boolean">true</argument>
1473: </arguments>
1474: </referenceContainer>
1475:</body>
Which although the line numbers still refer to the merged XML, it will allow the developer to search the source files for a more specific string. Making it much easier to find the source of the issue.
Related Pull Requests
https://github.com/magento-gl/magento2ee/pull/205
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
- Put the site into development mode, and disable cache.
- Add a breaking change to a layout XML file. e.g add:
<bar>foo</bar>
- Load the frontend of the site,
You should get an error message that you can use to find the offending configuration.
Questions or comments
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status