Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] feat: more informative error message on xml validation errors #37788

Closed
5 tasks
m2-assistant bot opened this issue Jul 24, 2023 · 2 comments · Fixed by #36836
Closed
5 tasks

[Issue] feat: more informative error message on xml validation errors #37788

m2-assistant bot opened this issue Jul 24, 2023 · 2 comments · Fixed by #36836
Labels
Area: UI Framework Component: Logger Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@m2-assistant
Copy link

m2-assistant bot commented Jul 24, 2023

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 (*)

  1. Put the site into development mode, and disable cache.
  2. Add a breaking change to a layout XML file. e.g add: <bar>foo</bar>
  3. 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)
@m2-assistant m2-assistant bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jul 24, 2023
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Jul 24, 2023
@engcom-Lima engcom-Lima added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Component: Logger Reported on 2.4.x Indicates original Magento version for the Issue report. Area: UI Framework labels Jul 24, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-9188 is successfully created for this GitHub issue.

@m2-assistant
Copy link
Author

m2-assistant bot commented Jul 24, 2023

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@github-jira-sync-bot github-jira-sync-bot added the Progress: PR Created Indicates that Pull Request has been created to fix issue label Aug 21, 2023
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Aug 31, 2023
@m2-community-project m2-community-project bot removed Progress: PR Created Indicates that Pull Request has been created to fix issue Progress: PR in progress labels Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: UI Framework Component: Logger Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

2 participants