Skip to content

[Issue] Introduce ErrorHandlerException to be thrown by the ErrorHandler #40352

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #38873: Introduce ErrorHandlerException to be thrown by the ErrorHandler


Description (*)

Currently any warning being thrown gets transformed into an exception.
This makes it much more difficult to attempt to handle these errors as you can only catch ALL exceptions and rethrow if you don't detect it's been thrown by the ErrorHandler.php

This PR introduces the ErrorHandlerException based on the ErrorException so the Severity, Filename and Linenumber are natively supported. Which is only to be thrown by the ErrorHandler.php

This will make it so we no longer need to catch every exception, then read the string to determine the severity to handle these errors anymore.
And as a bonus, error reporting software can be much more precise in bundling and adding context to warnings.

Manual testing scenarios (*)

  1. Make sure a warning will get thrown by adding e.g. compact('test') in the templates/html/header/logo.phtml
  2. Make sure you see the ErrorHandlerException being thrown

Questions or comments

In theory customising the error message is no longer necessary. Do we remove these changes, or keep it for backward compatibility?

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

No one assigned

    Labels

    Area: FrameworkComponent: Framework/AppIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions