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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/internal/Magento/Framework/App/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

$this->terminate($e);
}
} // phpcs:enable

Expand Down Expand Up @@ -418,12 +420,12 @@ public function isDeveloperMode()
/**
* Display an exception and terminate program execution
*
* @param \Exception $e
* @param \Throwable $e
* @return void
*
* phpcs:disable Magento2.Security.LanguageConstruct, Squiz.Commenting.FunctionCommentThrowTag
*/
protected function terminate(\Exception $e)
protected function terminate(\Throwable $e)
{

if ($this->isDeveloperMode()) {
Expand Down