Currently, if an exception is thrown when generating a block, a huge horrible fatal error is generated. Really we don't need to have anything quite that exotic. Why don't we put a try/catch around the block generation and not render the block (and emit a regular _drupal_log_error() or something) so that the administrator gets the information, but we don't deliver a full fatal error for every page where the block is to be rendered?

Related: #1184142: Views blocks: Catch exceptions when building blocks for views and #1184138: Catch exceptions for render/entity failures for commerce.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
1.92 KB

I think that's a great idea. Exceptions that occurs during block rendering can potentially hose the whole site for no real reason.

Here is a starter patch.

kscheirer’s picture

#1: 1184148-exception.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1184148-exception.patch, failed testing.

pflame’s picture

Status: Needs work » Needs review
FileSize
1.7 KB

I could not apply the patch to latest 8.x version of drupal. I changed the patch according to latest 8.x version and uploaded for this comment.

benjy’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
git apply ~/patches/1184148-exception-4.patch
error: patch failed: core/modules/block/block.module:877
error: core/modules/block/block.module: patch does not apply
Sivaji_Ganesh_Jojodae’s picture

It is entity_view($block, 'block'); that does rendering of block now. I'm not sure if this is still a valid issue to reroll a patch.

benjy’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes

Yes, this is no longer relevant to D8.

arunkumark’s picture

Status: Needs work » Needs review
FileSize
1.96 KB

I have rerolled the patch for the latest Drupal 7.x development version.

heatherwoz’s picture

Issue tags: -Needs reroll

Removing needs reroll tag. Looks like this is ready for review.