/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Message/ExceptionMessageFactory.php
39 строк
959 B
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2017 Adobe * All Rights Reserved. */ namespace Magento\Framework\Message; use Magento\Framework\Exception\RuntimeException; class ExceptionMessageFactory implements ExceptionMessageFactoryInterface { /** * @var \Magento\Framework\Message\Factory */ private $messageFactory; /** * @param Factory $messageFactory */ public function __construct(Factory $messageFactory) { $this->messageFactory = $messageFactory; } /** * @inheritdoc */ public function createMessage(\Exception $exception, $type = MessageInterface::TYPE_ERROR) { if ($exception instanceof \Exception) { return $this->messageFactory->create($type) ->setText($exception->getMessage()); } throw new RuntimeException( new \Magento\Framework\Phrase("Exception instance doesn't match %1 type", [\Exception::class]) ); } }