Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2011 at 22:57 UTC
Updated:
23 Mar 2012 at 19:57 UTC
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?
Comments
Comment #1
merlinofchaos commentedDid you really mean this to be in the Views queue?
Comment #2
rfayYes DamZ suggested filing it here since most Commerce blocks are or will be views blocks. I have to confess I filed a core issue as well, so by 2015 this may not be necessary in views.
Comment #3
merlinofchaos commentedHm. Maybe view execution should try/catch.
Comment #4
dawehnerWe catch in query_default at the moment.
Comment #5
merlinofchaos commentedSo there really isn't anything we need to do?
Comment #6
dawehnerSo it seems to be that drupal commerce throws some exceptions? Is this right?
Comment #7
merlinofchaos commentedMarking NMI. Need to know what might be throwing exceptions we don't already catch.
Comment #8
rfayActually, Entity module throws a pile of exceptions and both rules and Commerce use it extensively. It's quite fussy and throws a bunch of exceptions like EntityMetadataWrapperException, etc.
@DamZ posted #1184138-01: Catch exceptions for render/entity failures as a workaround for this on pure Commerce blocks. Seems like the approach would work more generally.
The bottom line is, if Views is creating a block and an unhandled exception reaches it, there's no reason for a complete fatal.
Comment #9
merlinofchaos commentedThere are a couple of issues here.
1) Why is Views' responsible for catching exceptions thrown by Entity module or Commerce module?
2) Why is a block constructed by Views likely to get these exceptions?
There's no explanations here, Randy, just a "You should do this" that's been repeated a couple of times now. I refuse to add cruft to my module until I understand why my module is responsible for other module's exceptions?
I respect that Views is responsible for catching PDO exceptions because Views is executing the query. That makes sense.
Comment #10
rfayThe idea here is this:
Blocks should not have the power to destroy Drupal installs. There's just no reason to let it be. Views is part of the solution here.
Views is the single best way to implement a block. And it's the single best short-term place to catch this problem.
I think that Drupal core should handle it, see: #1184148: Catch exceptions when building/rendering blocks. But that's a long-term solution, and views could be a shorter-term solution.
Comment #11
esmerel commentedComment #12
dawehnerWhy does the entity module not catch it's own exceptions?
Comment #13
dawehnerIs that still an issue?
Comment #14
rfayI guess I don't see why any block builder should just blindly throw an exception that brings down the site. I'd rather see the fix in core, but still... Why should a block builder encounter an exception and thus render the site inoperable (or at least all pages that contain the block)?
As far as specific Commerce problems, a number of them have been resolved.
Comment #15
esmerel commented