1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
GenerationException.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Landing\Copilot\Generation;
6
7use Bitrix\Main\SystemException;
8use Bitrix\Landing\Copilot\Generation\Type\GenerationErrors;
9
11{
15
16 private ?array $params;
17
24 public function __construct(GenerationErrors $code, string $message = '', ?array $params = null)
25 {
26 $this->params = $params;
28
29 parent::__construct($errorMessage, $code->value);
30 }
31
36 public function getCodeObject(): ?GenerationErrors
37 {
38 return GenerationErrors::tryFrom($this->getCode()) ?? GenerationErrors::default;
39 }
40
44 public function getParams(): ?array
45 {
46 return $this->params;
47 }
48
57 protected function buildErrorMessage(GenerationErrors $code, string $additionalMessage): string
58 {
59 $message = self::getErrorMessage($code);
60
61 if ($additionalMessage !== '')
62 {
63 return $message . ': ' . $additionalMessage . '.';
64 }
65
66 return $message . '.';
67 }
68
69 private static function getErrorMessage(GenerationErrors $code): string
70 {
71 $messages = [
72 GenerationErrors::default->value => 'Generation error',
73 GenerationErrors::notExistResponse->value => 'Response is not exist',
74 GenerationErrors::restrictedRequest->value => 'Request is not allowed',
75 GenerationErrors::dataValidation->value => 'Data validation error',
76 GenerationErrors::notFullyResponse->value => 'Response is not complete',
77 GenerationErrors::notCorrectResponse->value => 'Response is not correct',
78 GenerationErrors::requestQuotaExceeded->value => 'Not enough requests. Limit type',
79 GenerationErrors::notSendRequest->value => 'Request is not send',
80 GenerationErrors::errorInRequest->value => 'Error in request',
81 ];
82
83 return $messages[$code->value] ?? $messages[GenerationErrors::default->value];
84 }
85}
__construct(GenerationErrors $code, string $message='', ?array $params=null)
Определения GenerationException.php:24
buildErrorMessage(GenerationErrors $code, string $additionalMessage)
Определения GenerationException.php:57
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$message
Определения payment.php:8
$messages
Определения template.php:8
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799