Completed
Push — master ( 1cf093...a4ad75 )
by Arnaud
26s queued 11s
created

FieldDebugExtension::renderField()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
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