Completed
Pull Request — master (#120)
by Arnaud
07:48
created

FieldDebugExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderField() 0 11 2
1
<?php
2
3
namespace LAG\AdminBundle\Bridge\Twig\Extension;
4
5
use Exception;
6
use LAG\AdminBundle\Field\FieldInterface;
7
8
class FieldDebugExtension extends FieldExtension
9
{
10
    public function renderField(FieldInterface $field, $entity): string
11
    {
12
        try {
13
            return parent::renderField($field, $entity);
14
        } catch (Exception $exception) {
15
            $message = sprintf(
16
                'An error has occurred when rendering the field "%s" : %s',
17
                $field->getName(),
18
                $exception->getMessage()
19
            );
20
            throw new Exception($message, 0, $exception);
21
        }
22
    }
23
}
24