Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1184148-exception-8.patch | 1.96 KB | arunkumark |
#4 | 1184148-exception-4.patch | 1.7 KB | pflame |
#1 | 1184148-exception.patch | 1.92 KB | Damien Tournoud |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedI 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.
Comment #2
kscheirer#1: 1184148-exception.patch queued for re-testing.
Comment #4
pflame CreditAttribution: pflame commentedI 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.
Comment #5
benjy CreditAttribution: benjy commentedComment #6
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedIt 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.Comment #7
benjy CreditAttribution: benjy commentedYes, this is no longer relevant to D8.
Comment #8
arunkumarkI have rerolled the patch for the latest Drupal 7.x development version.
Comment #9
heatherwoz CreditAttribution: heatherwoz at University of Washington commentedRemoving needs reroll tag. Looks like this is ready for review.