Originally fixed in #1158322-109: Add backtrace to all errors, but that patch somehow got lost in a collective push to backport the verbose backtrace facility to D7.

Attached patch re-implements the verbose error level (with backtrace) handling from errors.inc in ExceptionController::on500().

As an example, simply hack Entity\FieldableEntityStorageControllerBase::load() to throw an exception. In HEAD, you get the error message only. With this patch, you get a clean backtrace.


Note that Symfony Debug's FlattenException does not correctly process all arguments currently; see https://github.com/symfony/symfony/pull/10195

Screenshots:

before
After

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Please note:

Any discussion about using a different error/exception handler from Symfony/HttpKernel/Whatnot should go in a separate issue.

The one and only purpose of this issue here is to fix our current exception handling, so that errors can be properly debugged.

Thanks in advance :-)

dawehner’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
FileSize
100.88 KB
23.29 KB

PS: Added some screenshots to show the greatness, which is part of the patch.

Any discussion about using a different error/exception handler from Symfony/HttpKernel/Whatnot should go in a separate issue.

Totally agree that we should not get crazy on this issue.

+ $error_level = $this->container->get('config.factory')->get('system.logging')->get('error_level');

I am a huge fun to avoid calling the container even if you have it available, but just use it to pass it along. As alternative you could inject still the actual dependency (config factory) additional,
but it does not seem to be really worth, given that this code will probably not be reused, neither really a production code, neither unit-testable.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed d861851 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.