Skip to content

Commit 0ea2f68

Browse files
committed
Throw ValidatorException with bad template in dev mode
1 parent 194eaf3 commit 0ea2f68

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/internal/Magento/Framework/View/Element/Template.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ public function fetchView($fileName)
259259
$errorMessage = "Invalid template file: '{$templatePath}' in module: '{$this->getModuleName()}'"
260260
. " block's name: '{$this->getNameInLayout()}'";
261261
if ($this->_appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
262-
throw new \InvalidArgumentException($errorMessage);
262+
throw new \Magento\Framework\Exception\ValidatorException(
263+
new \Magento\Framework\Phrase(
264+
$errorMessage
265+
)
266+
);
263267
}
264268
$this->_logger->critical($errorMessage);
265269
}

lib/internal/Magento/Framework/View/Test/Unit/Element/TemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function testFetchViewWithNoFileNameDeveloperMode()
196196
->method('getMode')
197197
->willReturn(\Magento\Framework\App\State::MODE_DEVELOPER);
198198

199-
$this->setExpectedException('\InvalidArgumentException', $exception);
199+
$this->setExpectedException('\Magento\Framework\Exception\ValidatorException', $exception);
200200
$this->block->fetchView($template);
201201
}
202202

0 commit comments

Comments
 (0)