Skip to content

Implement catching for all Errors - ref Magento issue #23350 #25250

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

Merged
merged 3 commits into from
Jan 8, 2020

Conversation

miszyman
Copy link

Description (*)

Leveraging PHP7+ Throwables (https://www.php.net/manual/en/class.throwable.php) to enable catching ALL possible errors as such might expose confidential information such passwords.

Fixed Issues (if relevant)

  1. Add support for catching throwables in App/Bootstrap #23350:Add support for catching throwables in App/Bootstrap

Manual testing scenarios (*)

  1. Trigger any error ex. TypeError ( https://www.php.net/manual/en/class.typeerror.php ) by calling a method with a wrong type.
  2. Error should be suppressed and logged into the system.log (assuming using production mode)

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)
  • All automated tests passed successfully (all builds are green)

@miszyman miszyman requested a review from buskamuza as a code owner October 23, 2019 18:12
@m2-assistant
Copy link

m2-assistant bot commented Oct 23, 2019

Hi @miszyman. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@@ -269,6 +269,8 @@ public function run(AppInterface $application)
}
} catch (\Exception $e) {
$this->terminate($e);
} catch (\Error $e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just change line 270 to } catch (\Throwable $e) { to make sure we catch everything?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed - however to be honest I thought about it but I left it like that for better visibility so that the Exception catching is left intact, as that is more common knowledge

Copy link
Contributor

@VladimirZaets VladimirZaets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @miszyman. Thanks for collaboration.
Please take a look at review comments

@miszyman
Copy link
Author

Hi @miszyman. Thanks for collaboration.
Please take a look at review comments

@VladimirZaets updated

@VladimirZaets VladimirZaets added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests and removed Progress: needs update labels Nov 6, 2019
@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-6242 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@miszyman thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@engcom-Alfa
Copy link
Contributor

@magento run all tests

@engcom-Golf
Copy link
Contributor

@magento run all tests

@VladimirZaets
Copy link
Contributor

@magento run all tests

@slavvka
Copy link
Member

slavvka commented Dec 9, 2019

The PR is under architectural review now. Please be patient

@slavvka slavvka self-assigned this Dec 9, 2019
Copy link
Member

@slavvka slavvka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is approved by Architects

@magento-engcom-team
Copy link
Contributor

Hi @slavvka, thank you for the review.
ENGCOM-6242 has been created to process this Pull Request

@m2-assistant
Copy link

m2-assistant bot commented Jan 8, 2020

Hi @miszyman, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.