Hide blocks with exceptions

Description

Current situation

When a block fires an exception a 500 error occurs. A small block error can take a whole website this way.

Required situation

When a block fires an exception the block will be hidden in prod mode and the exception will be logged in the production log. In dev mode the exception can be fired (the problem should be solved). In block edit mode show a message: "This block contains an error", so the user knows there is a block.

Technical tasks

None

Deployment actions

None

Activity

Show:
Marijn Otte
November 20, 2015, 2:19 PM

Maybe:

diff --git a/Document/Page/Grid/Item.php b/Document/Page/Grid/Item.php
index b82db55..8a7501c 100644
— a/Document/Page/Grid/Item.php
+++ b/Document/Page/Grid/Item.php
@@ -65,7 +65,10 @@ class Item
*/
public function getBlock()
{

  • return $this->block;
    + try {
    + return $this->block;
    + } catch (\Exception $e) {
    + }
    }

/**

Ger Jan van den Bosch
November 24, 2015, 3:13 PM

No thats not needed (see PR)

Ger Jan van den Bosch
November 26, 2015, 1:25 PM
Edited

The block error message only works with

Marijn Otte
December 7, 2015, 8:53 AM

the pull request in this issue is merged, but the issue is still assigned to you. Do you still have to do something, or can you click Code accepted?

Assignee

Unassigned

Client

None

Fix versions

Configure