Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
configexceptionhandler.php
1<?php
2
4
6
8{
10 private $exception;
11
13 private $errorCollection;
14
15 private function getErrorQueueGenerator() : \Generator
16 {
17 $currentException = $this->exception;
18 do
19 {
20 yield new Main\Error(
21 $currentException->getMessage(),
22 $currentException->getCode()
23 );
24 }
25 while($currentException = $currentException->getPrevious());
26 }
27
33 public function __construct(ConfigException $exception)
34 {
35 $this->exception = $exception;
36 }
37
41 public function getErrorCollection() : Main\ErrorCollection
42 {
43 return $this->errorCollection = $this->errorCollection ?? new Main\ErrorCollection(
44 array_filter(iterator_to_array($this->getErrorQueueGenerator()))
45 );
46 }
47
51 public function getCustomData()
52 {
53 return $this->exception->getCustomData();
54 }
55
61 public static function handle(ConfigException $exception)
62 {
63 return new self($exception);
64 }
65}