-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Issue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedProgress: doneTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
Summary (*)
I noticed that the inner try/catch in the run
method in lib/internal/App/Bootstrap.php
does not catch throwables. I was wondering if there is any downside in adding a catch for a \Throwable
.
Examples (*)
If an error is thrown (for example, a TypeError) it currently shows a browser generic 500 error.
Proposed solution
I would suggest adding the following catch block for minimal changes as a quite a lot of other methods, like the catchException
method for example, expect an instance of \Exception, and a TypeError isn't of that type.
catch (\Throwable $e) {
\Magento\Framework\Profiler::stop('magento');
$this->objectManager->get(LoggerInterface::class)->error($e->getMessage());
// Convert the Throwable to an exception to make it compatible with catchException
$ex = new \Exception($e->getMessage(), $e->getCode(), $e);
if (!$application->catchException($this, $ex)) {
throw $ex;
}
}
Metadata
Metadata
Assignees
Labels
Issue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedProgress: doneTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Type
Projects
Status
Done