/
ExceptionError.php
50 lines (44 loc) · 1.01 KB
/
ExceptionError.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Concrete\Core\Error\ErrorList\Error;
use Concrete\Core\Error\ErrorList\Field\FieldInterface;
use Exception;
class ExceptionError extends AbstractError
{
/**
* The associated Exception.
*
* @var \Exception
*/
protected $exception;
/**
* Class constructor.
*
* @param \Exception $exception
* @param \Concrete\Core\Error\ErrorList\Field\FieldInterface|null $field
*/
public function __construct(Exception $exception, FieldInterface $field = null)
{
$this->exception = $exception;
if ($field) {
$this->setField($field);
}
}
/**
* Get the associated Exception.
*
* @return \Exception
*/
public function getException()
{
return $this->exception;
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Error\ErrorList\Error\ErrorInterface::getMessage()
*/
public function getMessage()
{
return $this->getException()->getMessage();
}
}