diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php
old mode 100644
new mode 100755
index da907bde71f75..ca1e3038e0390
--- a/app/code/Magento/Catalog/Model/Entity/Attribute.php
+++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php
@@ -139,14 +139,14 @@ public function __construct(
* Processing object before save data
*
* @return \Magento\Framework\Model\AbstractModel
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function beforeSave()
{
try {
$this->attrLockValidator->validate($this);
} catch (\Magento\Framework\Exception\LocalizedException $exception) {
- throw new \Magento\Eav\Exception(__($exception->getMessage()));
+ throw new \Magento\Framework\Exception\LocalizedException(__($exception->getMessage()));
}
$this->setData('modulePrefix', self::MODULE_NAME);
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
old mode 100644
new mode 100755
index 2272520c1a4fd..5d21012f3964f
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
@@ -44,7 +44,7 @@ public function __construct(\Magento\Framework\Stdlib\String $string)
*
* @param Product $object
* @return bool
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function validate($object)
@@ -52,7 +52,7 @@ public function validate($object)
$attrCode = $this->getAttribute()->getAttributeCode();
$value = $object->getData($attrCode);
if ($this->getAttribute()->getIsRequired() && strlen($value) === 0) {
- throw new \Magento\Eav\Exception(__('The value of attribute "%1" must be set', $attrCode));
+ throw new \Magento\Framework\Exception\LocalizedException(__('The value of attribute "%1" must be set', $attrCode));
}
if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) {
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php
index f1f80f7701c0c..21a1ecedb1f40 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php
@@ -181,6 +181,7 @@ protected function _getCurrentConfigFileInfo()
* @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...)
* @return $this
* @throws LocalizedException
+ * @throws \Exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function validateUserValue($values)
@@ -222,9 +223,6 @@ public function validateUserValue($values)
$value = $this->validatorFile->setProduct($this->getProduct())
->validate($this->_getProcessingParams(), $option);
$this->setUserValue($value);
- } catch (\Magento\Framework\Exception\File\LargeSizeException $largeSizeException) {
- $this->setIsValid(false);
- throw new LocalizedException(__($largeSizeException->getMessage()));
} catch (ProductException $e) {
switch ($this->getProcessMode()) {
case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL:
@@ -236,7 +234,7 @@ public function validateUserValue($values)
}
} catch (\Magento\Framework\Validator\Exception $e) {
$this->setUserValue(null);
- } catch (\Magento\Framework\Exception\File\ValidatorException $e) {
+ } catch (LocalizedException $e) {
$this->setIsValid(false);
throw new LocalizedException(__($e->getMessage()));
} catch (\Exception $e) {
diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php
index beb1b3d2f8da1..9f8c3c955c96e 100644
--- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php
+++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php
@@ -9,6 +9,7 @@
use Magento\Catalog\Model\Product;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Catalog\Model\Product\Exception as ProductException;
+use Magento\Framework\Exception\LocalizedException;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -89,10 +90,12 @@ public function setProduct(Product $product)
* @param \Magento\Framework\Object $processingParams
* @param \Magento\Catalog\Model\Product\Option $option
* @return array
- * @throws \Magento\Framework\Exception\LocalizedException
- * @throws \Zend_File_Transfer_Exception
+ * @throws LocalizedException
+ * @throws ProductException
+ * @throws \Exception
+ * @throws \Magento\Framework\Exception\InputException
* @throws \Magento\Framework\Validator\Exception
- * @throws \Magento\Catalog\Model\Product\Exception
+ * @throws \Zend_File_Transfer_Exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
@@ -116,7 +119,7 @@ public function validate($processingParams, $option)
// when file exceeds the upload_max_filesize, $_FILES is empty
if ($this->validateContentLength()) {
$value = $this->fileSize->getMaxFileSizeInMb();
- throw new \Magento\Framework\Exception\File\LargeSizeException(
+ throw new LocalizedException(
__('The file you uploaded is larger than %1 Megabytes allowed by server', $value)
);
} else {
@@ -188,12 +191,10 @@ public function validate($processingParams, $option)
$errors = $this->getValidatorErrors($upload->getErrors(), $fileInfo, $option);
if (count($errors) > 0) {
- throw new \Magento\Framework\Exception\File\ValidatorException(__(implode("\n", $errors)));
+ throw new LocalizedException(__(implode("\n", $errors)));
}
} else {
- throw new \Magento\Framework\Exception\File\ValidatorException(
- __('Please specify the product\'s required option(s).')
- );
+ throw new LocalizedException(__('Please specify the product\'s required option(s).'));
}
return $userValue;
}
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
old mode 100644
new mode 100755
index a2cfaba45a1e0..af1dee02649e9
--- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
@@ -562,7 +562,7 @@ protected function calcRuleProductPrice($ruleData, $productData = null)
* @param int $websiteId
* @param int|null $productId
* @return \Zend_Db_Statement_Interface
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
protected function getRuleProductsStmt($websiteId, $productId = null)
{
diff --git a/app/code/Magento/Developer/Model/View/Layout/Plugin.php b/app/code/Magento/Developer/Model/View/Layout/Plugin.php
new file mode 100644
index 0000000000000..4f4f059813d58
--- /dev/null
+++ b/app/code/Magento/Developer/Model/View/Layout/Plugin.php
@@ -0,0 +1,61 @@
+appState = $appState;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @param \Magento\Framework\View\Layout $subject
+ * @param callable $proceed
+ * @param string $name
+ * @return string
+ * @throws \Exception
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ */
+ public function aroundRenderNonCachedElement(\Magento\Framework\View\Layout $subject, \Closure $proceed, $name)
+ {
+ $result = '';
+ try {
+ $result = $proceed($name);
+ } catch (\Exception $e) {
+ if ($this->appState->getMode() === State::MODE_DEVELOPER) {
+ throw $e;
+ }
+ $message = ($e instanceof LocalizedException) ? $e->getLogMessage() : $e->getMessage();
+ $this->logger->critical($message);
+ }
+ return $result;
+ }
+}
diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml
index d923b3d55553d..1a21f191e0909 100644
--- a/app/code/Magento/Developer/etc/di.xml
+++ b/app/code/Magento/Developer/etc/di.xml
@@ -10,6 +10,9 @@
+
+
+
Magento\Developer\Model\View\Page\Config\RendererFactory
diff --git a/app/code/Magento/Eav/Exception.php b/app/code/Magento/Eav/Exception.php
deleted file mode 100644
index ed5a6dd53d714..0000000000000
--- a/app/code/Magento/Eav/Exception.php
+++ /dev/null
@@ -1,10 +0,0 @@
-_type)) {
- throw new EavException(__('Entity is not initialized'));
+ throw new LocalizedException(__('Entity is not initialized'));
}
return $this->_type;
}
@@ -372,7 +372,7 @@ public function getTypeId()
*
* @param array|string|null $attributes
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function unsetAttributes($attributes = null)
{
@@ -387,7 +387,7 @@ public function unsetAttributes($attributes = null)
}
if (!is_array($attributes)) {
- throw new EavException(__('Unknown parameter'));
+ throw new LocalizedException(__('Unknown parameter'));
}
foreach ($attributes as $attrCode) {
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php
old mode 100644
new mode 100755
index df877f97a92af..5682724a47726
--- a/app/code/Magento/Eav/Model/Entity/Attribute.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Eav\Model\Entity;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Api\AttributeValueFactory;
/**
@@ -213,7 +213,7 @@ public function loadEntityAttributeIdBySet()
* Prepare data for save
*
* @return $this
- * @throws EavException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
@@ -221,7 +221,7 @@ public function beforeSave()
{
// prevent overriding product data
if (isset($this->_data['attribute_code']) && $this->reservedAttributeList->isReservedAttribute($this)) {
- throw new EavException(
+ throw new LocalizedException(
__(
'The attribute code \'%1\' is reserved by system. Please try another attribute code',
$this->_data['attribute_code']
@@ -240,7 +240,7 @@ public function beforeSave()
['max' => self::ATTRIBUTE_CODE_MAX_LENGTH]
)
) {
- throw new EavException(
+ throw new LocalizedException(
__('Maximum length of attribute code must be less than %1 symbols', self::ATTRIBUTE_CODE_MAX_LENGTH)
);
}
@@ -252,7 +252,7 @@ public function beforeSave()
$numberFormatter = new \NumberFormatter($this->_localeResolver->getLocale(), \NumberFormatter::DECIMAL);
$defaultValue = $numberFormatter->parse($defaultValue);
if ($defaultValue === false) {
- throw new EavException(__('Invalid default decimal value'));
+ throw new LocalizedException(__('Invalid default decimal value'));
}
$this->setDefaultValue($defaultValue);
}
@@ -275,7 +275,7 @@ public function beforeSave()
$defaultValue = \IntlDateFormatter::formatObject(new \DateTime($defaultValue), $format);
$this->setDefaultValue($defaultValue);
} catch (\Exception $e) {
- throw new EavException(__('Invalid default date'));
+ throw new LocalizedException(__('Invalid default date'));
}
}
}
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
old mode 100644
new mode 100755
index e52ab0860e202..9dbc048d711ec
--- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php
@@ -6,7 +6,7 @@
namespace Magento\Eav\Model\Entity\Attribute;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Api\AttributeValueFactory;
/**
@@ -181,7 +181,7 @@ protected function _construct()
* @param string|int|\Magento\Eav\Model\Entity\Type $entityType
* @param string $code
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function loadByCode($entityType, $code)
{
@@ -195,7 +195,7 @@ public function loadByCode($entityType, $code)
$entityTypeId = $entityType->getId();
}
if (empty($entityTypeId)) {
- throw new EavException(__('Invalid entity supplied'));
+ throw new LocalizedException(__('Invalid entity supplied'));
}
$this->_getResource()->loadByCode($this, $entityTypeId, $code);
$this->_afterLoad();
@@ -461,7 +461,7 @@ public function getEntityIdField()
* Retrieve backend instance
*
* @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
- * @throws EavException
+ * @throws LocalizedException
*/
public function getBackend()
{
@@ -471,7 +471,7 @@ public function getBackend()
}
$backend = $this->_universalFactory->create($this->getBackendModel());
if (!$backend) {
- throw new EavException(__('Invalid backend model specified: ' . $this->getBackendModel()));
+ throw new LocalizedException(__('Invalid backend model specified: ' . $this->getBackendModel()));
}
$this->_backend = $backend->setAttribute($this);
}
@@ -500,7 +500,7 @@ public function getFrontend()
* Retrieve source instance
*
* @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
- * @throws EavException
+ * @throws LocalizedException
*/
public function getSource()
{
@@ -510,7 +510,7 @@ public function getSource()
}
$source = $this->_universalFactory->create($this->getSourceModel());
if (!$source) {
- throw new EavException(
+ throw new LocalizedException(
__(
'Source model "%1" not found for attribute "%2"',
$this->getSourceModel(),
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
old mode 100644
new mode 100755
index 9950d293cba19..aa010892c6495
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Eav\Model\Entity\Attribute\Backend;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
/**
* Entity/Attribute/Model - attribute backend abstract
@@ -214,7 +214,7 @@ public function getDefaultValue()
*
* @param \Magento\Framework\Object $object
* @return bool
- * @throws EavException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function validate($object)
@@ -223,7 +223,7 @@ public function validate($object)
$attrCode = $attribute->getAttributeCode();
$value = $object->getData($attrCode);
if ($attribute->getIsVisible() && $attribute->getIsRequired() && $attribute->isValueEmpty($value)) {
- throw new EavException(__('The value of attribute "%1" must be set', $attrCode));
+ throw new LocalizedException(__('The value of attribute "%1" must be set', $attrCode));
}
if ($attribute->getIsUnique()
@@ -236,7 +236,7 @@ public function validate($object)
if ($attribute->getIsUnique()) {
if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) {
$label = $attribute->getFrontend()->getLabel();
- throw new EavException(__('The value of attribute "%1" must be unique', $label));
+ throw new LocalizedException(__('The value of attribute "%1" must be unique', $label));
}
}
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
old mode 100644
new mode 100755
index 4145ac0a68cd9..147f1dcdd0bc8
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
@@ -30,7 +30,7 @@ public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface
* necessary for further process, else date string
*
* @param \Magento\Framework\Object $object
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
* @return $this
*/
public function beforeSave($object)
@@ -41,7 +41,7 @@ public function beforeSave($object)
try {
$value = $this->formatDate($object->getData($attributeName));
} catch (\Exception $e) {
- throw new \Magento\Eav\Exception(__('Invalid date'));
+ throw new \Magento\Framework\Exception\LocalizedException(__('Invalid date'));
}
if (is_null($value)) {
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
old mode 100644
new mode 100755
index c8eb151622d4d..446f4fd65a88b
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php
@@ -19,7 +19,7 @@
*/
namespace Magento\Eav\Model\Entity\Attribute;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Eav\Model\Entity\Type;
use Magento\Framework\Api\AttributeValueFactory;
@@ -255,17 +255,17 @@ public function organizeData($data)
* Validate attribute set name
*
* @return bool
- * @throws EavException
+ * @throws LocalizedException
*/
public function validate()
{
$attributeSetName = $this->getAttributeSetName();
if ($attributeSetName == '') {
- throw new EavException(__('Attribute set name is empty.'));
+ throw new LocalizedException(__('Attribute set name is empty.'));
}
if (!$this->_getResource()->validate($this, $attributeSetName)) {
- throw new EavException(__('An attribute set with the "%1" name already exists.', $attributeSetName));
+ throw new LocalizedException(__('An attribute set with the "%1" name already exists.', $attributeSetName));
}
return true;
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php
old mode 100644
new mode 100755
index 427000b106f5e..6417cd0b506d8
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php
@@ -30,7 +30,7 @@ public function __construct(array $options)
/**
* Retrieve all options for the source from configuration
*
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
* @return array
*/
public function getAllOptions()
@@ -39,7 +39,7 @@ public function getAllOptions()
$this->_options = [];
if (empty($this->_optionsData)) {
- throw new \Magento\Eav\Exception(__('No options found.'));
+ throw new \Magento\Framework\Exception\LocalizedException(__('No options found.'));
}
foreach ($this->_optionsData as $option) {
$this->_options[] = ['value' => $option['value'], 'label' => __($option['label'])];
diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
old mode 100644
new mode 100755
index 6cd6cf0e6d018..72712e67c4406
--- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
+++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php
@@ -6,7 +6,7 @@
namespace Magento\Eav\Model\Entity\Collection;
use Magento\Framework\DB\Select;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
/**
* Entity/Attribute/Model - collection abstract
@@ -225,7 +225,7 @@ protected function _init($model, $entityModel)
*
* @param \Magento\Eav\Model\Entity\AbstractEntity $entity
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function setEntity($entity)
{
@@ -234,7 +234,7 @@ public function setEntity($entity)
} elseif (is_string($entity) || $entity instanceof \Magento\Framework\App\Config\Element) {
$this->_entity = $this->_eavEntityFactory->create()->setType($entity);
} else {
- throw new EavException(__('Invalid entity supplied: %1', print_r($entity, 1)));
+ throw new LocalizedException(__('Invalid entity supplied: %1', print_r($entity, 1)));
}
return $this;
}
@@ -243,12 +243,12 @@ public function setEntity($entity)
* Get collection's entity object
*
* @return \Magento\Eav\Model\Entity\AbstractEntity
- * @throws EavException
+ * @throws LocalizedException
*/
public function getEntity()
{
if (empty($this->_entity)) {
- throw new EavException(__('Entity is not initialized'));
+ throw new LocalizedException(__('Entity is not initialized'));
}
return $this->_entity;
}
@@ -284,12 +284,12 @@ public function setObject($object = null)
*
* @param \Magento\Framework\Object $object
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function addItem(\Magento\Framework\Object $object)
{
if (!$object instanceof $this->_itemObjectClass) {
- throw new EavException(__('Attempt to add an invalid object'));
+ throw new LocalizedException(__('Attempt to add an invalid object'));
}
return parent::addItem($object);
}
@@ -449,7 +449,7 @@ protected function _prepareOrderExpression($field)
* @param array|string|integer|\Magento\Framework\App\Config\Element $attribute
* @param bool|string $joinType flag for joining attribute
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function addAttributeToSelect($attribute, $joinType = false)
{
@@ -474,7 +474,7 @@ public function addAttributeToSelect($attribute, $joinType = false)
$attrInstance = $this->_eavConfig->getAttribute($this->getEntity()->getType(), $attribute);
}
if (empty($attrInstance)) {
- throw new EavException(__('Invalid attribute requested: %1', (string)$attribute));
+ throw new LocalizedException(__('Invalid attribute requested: %1', (string)$attribute));
}
$this->_selectAttributes[$attrInstance->getAttributeCode()] = $attrInstance->getId();
}
@@ -520,13 +520,13 @@ public function addStaticField($field)
* @param string $expression
* @param string $attribute
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function addExpressionAttributeToSelect($alias, $expression, $attribute)
{
// validate alias
if (isset($this->_joinFields[$alias])) {
- throw new EavException(__('Joint field or attribute expression with this alias is already declared'));
+ throw new LocalizedException(__('Joint field or attribute expression with this alias is already declared'));
}
if (!is_array($attribute)) {
$attribute = [$attribute];
@@ -622,7 +622,7 @@ public function groupByAttribute($attribute)
* @param string $joinType inner|left
* @param null $storeId
* @return $this
- * @throws EavException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
@@ -630,7 +630,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy
{
// validate alias
if (isset($this->_joinAttributes[$alias])) {
- throw new EavException(__('Invalid alias, already exists in joint attributes'));
+ throw new LocalizedException(__('Invalid alias, already exists in joint attributes'));
}
$bindAttribute = null;
@@ -640,7 +640,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy
}
if (!$bindAttribute || !$bindAttribute->isStatic() && !$bindAttribute->getId()) {
- throw new EavException(__('Invalid foreign key'));
+ throw new LocalizedException(__('Invalid foreign key'));
}
// try to explode combined entity/attribute if supplied
@@ -664,7 +664,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy
}
}
if (!$entity || !$entity->getTypeId()) {
- throw new EavException(__('Invalid entity type'));
+ throw new LocalizedException(__('Invalid entity type'));
}
// cache entity
@@ -677,7 +677,7 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy
$attribute = $entity->getAttribute($attribute);
}
if (!$attribute) {
- throw new EavException(__('Invalid attribute type'));
+ throw new LocalizedException(__('Invalid attribute type'));
}
if (empty($filter)) {
@@ -712,13 +712,13 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy
* @param string|array $cond "{{table}}.language_code='en'" OR array('language_code'=>'en')
* @param string $joinType 'left'
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function joinField($alias, $table, $field, $bind, $cond = null, $joinType = 'inner')
{
// validate alias
if (isset($this->_joinFields[$alias])) {
- throw new EavException(__('A joined field with this alias is already declared.'));
+ throw new LocalizedException(__('A joined field with this alias is already declared.'));
}
$table = $this->_resource->getTableName($table);
@@ -774,7 +774,7 @@ public function joinField($alias, $table, $field, $bind, $cond = null, $joinType
* @param null|array $cond
* @param string $joinType
* @return $this
- * @throws EavException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function joinTable($table, $bind, $fields = null, $cond = null, $joinType = 'inner')
@@ -793,11 +793,11 @@ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType
// validate fields and aliases
if (!$fields) {
- throw new EavException(__('Invalid joint fields'));
+ throw new LocalizedException(__('Invalid joint fields'));
}
foreach ($fields as $alias => $field) {
if (isset($this->_joinFields[$alias])) {
- throw new EavException(__('A joint field with this alias (%1) is already declared.', $alias));
+ throw new LocalizedException(__('A joint field with this alias (%1) is already declared.', $alias));
}
$this->_joinFields[$alias] = ['table' => $tableAlias, 'field' => $field];
}
@@ -1100,7 +1100,7 @@ public function _loadEntities($printQuery = false, $logQuery = false)
* @param bool $printQuery
* @param bool $logQuery
* @return $this
- * @throws EavException
+ * @throws LocalizedException
* @throws \Exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -1214,14 +1214,14 @@ protected function _addLoadAttributesSelectValues($select, $table, $type)
*
* @param array $valueInfo
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
protected function _setItemAttributeValue($valueInfo)
{
$entityIdField = $this->getEntity()->getEntityIdField();
$entityId = $valueInfo[$entityIdField];
if (!isset($this->_itemsById[$entityId])) {
- throw new EavException(__('Data integrity: No header row found for attribute'));
+ throw new LocalizedException(__('Data integrity: No header row found for attribute'));
}
$attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes);
if (!$attributeCode) {
@@ -1255,7 +1255,7 @@ protected function _getAttributeTableAlias($attributeCode)
*
* @param string $attributeCode
* @return string
- * @throws EavException
+ * @throws LocalizedException
*/
protected function _getAttributeFieldName($attributeCode)
{
@@ -1273,7 +1273,7 @@ protected function _getAttributeFieldName($attributeCode)
$attribute = $this->getAttribute($attributeCode);
if (!$attribute) {
- throw new EavException(__('Invalid attribute name: %1', $attributeCode));
+ throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode));
}
if ($attribute->isStatic()) {
@@ -1295,7 +1295,7 @@ protected function _getAttributeFieldName($attributeCode)
* @param string $attributeCode
* @param string $joinType inner|left
* @return $this
- * @throws EavException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _addAttributeJoin($attributeCode, $joinType = 'inner')
@@ -1333,7 +1333,7 @@ protected function _addAttributeJoin($attributeCode, $joinType = 'inner')
}
if (!$attribute) {
- throw new EavException(__('Invalid attribute name: %1', $attributeCode));
+ throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode));
}
if ($attribute->getBackend()->isStatic()) {
diff --git a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php
old mode 100644
new mode 100755
index f413b900610a9..06c71132bf982
--- a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php
+++ b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php
@@ -31,7 +31,7 @@ public function getAllowedChars()
* Get next id
*
* @return string
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function getNextId()
{
@@ -52,7 +52,9 @@ public function getNextId()
for ($i = $lid; $i >= 0; $i--) {
$p = strpos($chars, $lastId[$i]);
if (false === $p) {
- throw new \Magento\Eav\Exception(__('Invalid character encountered in increment ID: %1', $lastId));
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Invalid character encountered in increment ID: %1', $lastId)
+ );
}
if ($bumpNextChar) {
$p++;
diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php
old mode 100644
new mode 100755
index 4e2a177f364bc..cccb9d3b0286e
--- a/app/code/Magento/Eav/Setup/EavSetup.php
+++ b/app/code/Magento/Eav/Setup/EavSetup.php
@@ -10,7 +10,7 @@
use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
-use Magento\Eav\Exception as EavException;
+use Magento\Framework\Exception\LocalizedException;
/**
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
@@ -247,7 +247,7 @@ public function getEntityType($id, $field = null)
*
* @param int|string $entityTypeId
* @return int
- * @throws EavException
+ * @throws LocalizedException
*/
public function getEntityTypeId($entityTypeId)
{
@@ -255,7 +255,7 @@ public function getEntityTypeId($entityTypeId)
$entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id');
}
if (!is_numeric($entityTypeId)) {
- throw new EavException(__('Wrong entity ID'));
+ throw new LocalizedException(__('Wrong entity ID'));
}
return $entityTypeId;
@@ -381,7 +381,7 @@ public function getAttributeSet($entityTypeId, $id, $field = null)
* @param int|string $entityTypeId
* @param int|string $setId
* @return int
- * @throws EavException
+ * @throws LocalizedException
*/
public function getAttributeSetId($entityTypeId, $setId)
{
@@ -389,7 +389,7 @@ public function getAttributeSetId($entityTypeId, $setId)
$setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id');
}
if (!is_numeric($setId)) {
- throw new EavException(__('Wrong attribute set ID'));
+ throw new LocalizedException(__('Wrong attribute set ID'));
}
return $setId;
@@ -598,7 +598,7 @@ public function getAttributeGroup($entityTypeId, $setId, $id, $field = null)
* @param int|string $setId
* @param int|string $groupId
* @return $this
- * @throws EavException
+ * @throws LocalizedException
*/
public function getAttributeGroupId($entityTypeId, $setId, $groupId)
{
@@ -611,7 +611,7 @@ public function getAttributeGroupId($entityTypeId, $setId, $groupId)
}
if (!is_numeric($groupId)) {
- throw new EavException(__('Wrong attribute group ID'));
+ throw new LocalizedException(__('Wrong attribute group ID'));
}
return $groupId;
}
@@ -713,7 +713,7 @@ private function _getValue($array, $key, $default = null)
*
* @param array $data
* @return true
- * @throws EavException
+ * @throws LocalizedException
*/
private function _validateAttributeData($data)
{
@@ -727,7 +727,7 @@ private function _validateAttributeData($data)
['max' => $attributeCodeMaxLength]
)
) {
- throw new EavException(
+ throw new LocalizedException(
__('Maximum length of attribute code must be less than %1 symbols', $attributeCodeMaxLength)
);
}
diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php
old mode 100644
new mode 100755
index 23d24c8edd47f..7a81bd55d364f
--- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php
@@ -51,7 +51,7 @@ public function testValidateWithExistingName($attributeSetName, $exceptionMessag
{
$this->_model->getResource()->expects($this->any())->method('validate')->will($this->returnValue(false));
- $this->setExpectedException('Magento\Eav\Exception', $exceptionMessage);
+ $this->setExpectedException('Magento\Framework\Exception\LocalizedException', $exceptionMessage);
$this->_model->setAttributeSetName($attributeSetName);
$this->_model->validate();
}
diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php
old mode 100644
new mode 100755
index bbf9f3b253563..23bd155a23f02
--- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php
@@ -54,7 +54,7 @@ public function getLastIdDataProvider()
}
/**
- * @expectedException \Magento\Eav\Exception
+ * @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage Invalid character encountered in increment ID: ---wrong-id---
*/
public function testGetNextIdThrowsExceptionIfIdContainsNotAllowedCharacters()
diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php
index 21c1fc1cf7589..b89948409ebd2 100644
--- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php
+++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php
@@ -5,6 +5,8 @@
*/
namespace Magento\OfflineShipping\Model\Carrier;
+use Magento\Framework\Exception\LocalizedException;
+
class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
\Magento\Shipping\Model\Carrier\CarrierInterface
{
@@ -197,7 +199,7 @@ public function getRate(\Magento\Quote\Model\Quote\Address\RateRequest $request)
* @param string $type
* @param string $code
* @return array
- * @throws \Magento\Shipping\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function getCode($type, $code = '')
{
@@ -215,7 +217,7 @@ public function getCode($type, $code = '')
];
if (!isset($codes[$type])) {
- throw new \Magento\Shipping\Exception(__('Please correct Table Rate code type: %1.', $type));
+ throw new LocalizedException(__('Please correct Table Rate code type: %1.', $type));
}
if ('' === $code) {
@@ -223,7 +225,7 @@ public function getCode($type, $code = '')
}
if (!isset($codes[$type][$code])) {
- throw new \Magento\Shipping\Exception(__('Please correct Table Rate code for type %1: %2.', $type, $code));
+ throw new LocalizedException(__('Please correct Table Rate code for type %1: %2.', $type, $code));
}
return $codes[$type][$code];
diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
index cb2a9333fe01e..ea190558cac88 100644
--- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
@@ -323,7 +323,7 @@ public function resolveCustomerNames()
*
* @param array $productIds
* @return array
- * @throws \Magento\Eav\Exception
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
protected function getProductData(array $productIds)
{
diff --git a/app/code/Magento/Shipping/Exception.php b/app/code/Magento/Shipping/Exception.php
deleted file mode 100755
index b140b961cf6d2..0000000000000
--- a/app/code/Magento/Shipping/Exception.php
+++ /dev/null
@@ -1,10 +0,0 @@
-setExpectedException(
- '\Magento\Framework\Exception\File\LargeSizeException',
+ '\Magento\Framework\Exception\LocalizedException',
sprintf('The file you uploaded is larger than %s Megabytes allowed by server', $this->maxFileSizeInMb)
);
$this->prepareEnv();
@@ -108,7 +108,7 @@ public function testOptionRequiredException()
}
/**
- * @expectedException \Magento\Framework\Exception\File\ValidatorException
+ * @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage Please specify the product's required option(s).
* @return void
*/
@@ -131,7 +131,7 @@ public function testException()
public function testInvalidateFile()
{
$this->setExpectedException(
- '\Magento\Framework\Exception\File\ValidatorException',
+ '\Magento\Framework\Exception\LocalizedException',
"The file 'test.jpg' for 'MediaOption' has an invalid extension.\n"
. "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n"
. "Maximum allowed image size for 'MediaOption' is 2000x2000 px.\n"
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php
new file mode 100644
index 0000000000000..0732a8e7916e7
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php
@@ -0,0 +1,44 @@
+Rendered with action problem.
';
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php
new file mode 100644
index 0000000000000..b421b1f76d693
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php
@@ -0,0 +1,30 @@
+Rendered with construction problem.';
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php
new file mode 100644
index 0000000000000..4673250a1cb08
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php
@@ -0,0 +1,34 @@
+Rendered with layout problem.';
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
new file mode 100644
index 0000000000000..64d383ed99a24
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
@@ -0,0 +1,57 @@
+get('Magento\Framework\View\LayoutFactory');
+ $this->layout = $layoutFactory->create();
+ $layoutElement = new \Magento\Framework\View\Layout\Element(
+ __DIR__ . '/_files/layout_with_exceptions/layout.xml',
+ 0,
+ true
+ );
+
+ $this->layout->setXml($layoutElement);
+ $objectManager->get('Magento\Framework\App\Cache\Type\Layout')->clean();
+ }
+
+ /**
+ * @expectedException \Magento\Framework\Exception\LocalizedException
+ * @expectedExceptionMessage Construction problem.
+ */
+ public function testProcessWithExceptionsDeveloperMode()
+ {
+ $this->layout->generateElements();
+ }
+
+ /**
+ * @magentoAppIsolation enabled
+ */
+ public function testProcessWithExceptions()
+ {
+ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\State')
+ ->setMode(State::MODE_DEFAULT);
+
+ $this->layout->generateElements();
+
+ $this->layout->addOutputElement('block.with.broken.constructor');
+ $this->layout->addOutputElement('block.with.broken.layout');
+ $this->layout->addOutputElement('block.with.broken.action');
+
+ $this->assertEmpty($this->layout->getOutput());
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
index 2f43263c6989c..df662db1bd7af 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php
@@ -104,6 +104,8 @@ public function getLayoutDependencies()
'cache' => $objectManager->get('Magento\Framework\App\Cache\Type\Layout'),
'readerContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Reader\ContextFactory'),
'generatorContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Generator\ContextFactory'),
+ 'appState' => $objectManager->get('Magento\Framework\App\State'),
+ 'logger' => $objectManager->get('Psr\Log\LoggerInterface'),
];
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml
new file mode 100644
index 0000000000000..a52c0a6645cf3
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+ action
+
+
+
+
+
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php
new file mode 100644
index 0000000000000..b7fb0b8ae7a94
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php
@@ -0,0 +1,73 @@
+assertTrue(
+ $reflectionException->isSubclassOf('Magento\Framework\Exception\LocalizedException'),
+ "{$reflectionException->name} is not inherited LocalizedException"
+ );
+ }
+
+ /**
+ * @return array
+ */
+ public function isInheritedLocalizedExceptionDataProvider()
+ {
+ $files = UtilityFiles::init()->getClassFiles(true, false, false, true, false);
+ $blacklistExceptions = $this->getBlacklistExceptions();
+
+ $data = [];
+ foreach ($files as $file) {
+ $className = $this->convertPathToClassName($file);
+ try {
+ $reflectionClass = new \ReflectionClass($className);
+ if ($reflectionClass->isSubclassOf('Exception') && !in_array($className, $blacklistExceptions)) {
+ $data[$className] = [$reflectionClass];
+ }
+ } catch (\Exception $e) {
+ $this->fail("File name and class name '{$className}' is not appropriate");
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * @param string $filePath
+ * @return string
+ */
+ protected function convertPathToClassName($filePath)
+ {
+ $className = str_replace('.php', "", substr($filePath, strpos($filePath, '/Magento')));
+ $className = implode("\\", explode("/", $className));
+ return $className;
+ }
+
+ /**
+ * @return array
+ */
+ protected function getBlacklistExceptions()
+ {
+ $blacklistFiles = str_replace('\\', '/', realpath(__DIR__)) . '/_files/blacklist/exception_hierarchy*.txt';
+ $exceptions = [];
+ foreach (glob($blacklistFiles) as $fileName) {
+ $exceptions = array_merge($exceptions, file($fileName, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES));
+ }
+ return $exceptions;
+ }
+}
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt
new file mode 100644
index 0000000000000..068e1ea553cbd
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt
@@ -0,0 +1,4 @@
+\Magento\Framework\Exception\LocalizedException
+\Magento\Framework\View\Asset\File\NotFoundException
+\Magento\Framework\Config\Dom\ValidationException
+\Magento\Framework\Gdata\Gshopping\HttpException
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
old mode 100644
new mode 100755
index ea38ddcc122e4..57cd1b6a4c817
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -3118,6 +3118,19 @@
['Magento\LocaleFactory'],
['Magento\Framework\LocaleFactory'],
['Magento\Core\Helper\Data', 'Magento\Framework\Json\Helper\Data'],
+ ['Magento\Framework\App\DeploymentConfig\BackendConfig'],
+ ['Magento\Framework\App\DeploymentConfig\DbConfig'],
+ ['Magento\Framework\App\DeploymentConfig\InstallConfig'],
+ ['Magento\Framework\App\DeploymentConfig\ResourceConfig'],
+ ['Magento\Framework\App\DeploymentConfig\SessionConfig'],
+ ['Magento\Framework\App\DeploymentConfig\CacheConfig'],
+ ['Magento\Setup\Model\DeploymentConfigMapper'],
+ ['Magento\Framework\App\DeploymentConfig\EncryptConfig'],
+ ['Magento\Framework\Filesystem\Io\IoException'],
+ ['Magento\Framework\DB\DBException'],
+ ['Magento\Framework\DB\Tree\TreeException'],
+ ['Magento\Framework\DB\Tree\Node\NodeException'],
+ ['Magento\Framework\DB\Tree\NodeSet\NodeSetException'],
['Magento\Backup\Exception'],
['Magento\Catalog\Exception'],
['Magento\Reports\Exception'],
@@ -3138,18 +3151,14 @@
['Magento\CatalogRule\CatalogRuleException'],
['Magento\Payment\Exception'],
['Magento\UrlRewrite\Model\Storage\DuplicateEntryException'],
- ['Magento\Framework\App\DeploymentConfig\BackendConfig'],
- ['Magento\Framework\App\DeploymentConfig\DbConfig'],
- ['Magento\Framework\App\DeploymentConfig\InstallConfig'],
- ['Magento\Framework\App\DeploymentConfig\ResourceConfig'],
- ['Magento\Framework\App\DeploymentConfig\SessionConfig'],
- ['Magento\Framework\App\DeploymentConfig\CacheConfig'],
- ['Magento\Setup\Model\DeploymentConfigMapper'],
- ['Magento\Framework\App\DeploymentConfig\EncryptConfig'],
['Magento\Setup\Mvc\Console\RouteListener'],
['Magento\Setup\Mvc\Console\RouteMatcher'],
['Magento\Setup\Mvc\Console\VerboseValidator'],
['Magento\Setup\Controller\ConsoleController'],
['Magento\Setup\Model\UserConfigurationDataMapper', 'Magento\Setup\Model\StoreConfigurationDataMapper'],
['Magento\Framework\App\State\Cleanup', 'Magento\Framework\App\State\CleanupFiles'],
+ ['Magento\Eav\Exception'],
+ ['Magento\Framework\Exception\File\ValidatorException'],
+ ['Magento\Framework\Filesystem\FilesystemException', 'Magento\Framework\Exception\FileSystemException'],
+ ['Magento\Shipping\Exception'],
];
diff --git a/lib/internal/Magento/Framework/Archive/Helper/File.php b/lib/internal/Magento/Framework/Archive/Helper/File.php
old mode 100644
new mode 100755
index 549c3b8849fe7..eab51af7b2c87
--- a/lib/internal/Magento/Framework/Archive/Helper/File.php
+++ b/lib/internal/Magento/Framework/Archive/Helper/File.php
@@ -11,7 +11,7 @@
*/
namespace Magento\Framework\Archive\Helper;
-use Magento\Framework\Exception\LocalizedException as MagentoException;
+use Magento\Framework\Exception\LocalizedException;
class File
{
@@ -87,7 +87,7 @@ public function __destruct()
* @param string $mode
* @param int $chmod
* @return void
- * @throws MagentoException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function open($mode = 'w+', $chmod = 0666)
@@ -96,13 +96,13 @@ public function open($mode = 'w+', $chmod = 0666)
if ($this->_isInWriteMode) {
if (!is_writable($this->_fileLocation)) {
- throw new MagentoException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('Permission denied to write to %1', [$this->_fileLocation])
);
}
if (is_file($this->_filePath) && !is_writable($this->_filePath)) {
- throw new MagentoException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase(
"Can't open file %1 for writing. Permission denied.",
[$this->_fileName]
@@ -113,13 +113,13 @@ public function open($mode = 'w+', $chmod = 0666)
if ($this->_isReadableMode($mode) && (!is_file($this->_filePath) || !is_readable($this->_filePath))) {
if (!is_file($this->_filePath)) {
- throw new MagentoException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('File %1 does not exist', [$this->_filePath])
);
}
if (!is_readable($this->_filePath)) {
- throw new MagentoException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('Permission denied to read file %1', [$this->_filePath])
);
}
@@ -191,14 +191,14 @@ public function close()
*
* @param string $mode
* @return void
- * @throws MagentoException
+ * @throws LocalizedException
*/
protected function _open($mode)
{
$this->_fileHandler = @fopen($this->_filePath, $mode);
if (false === $this->_fileHandler) {
- throw new MagentoException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]));
+ throw new LocalizedException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath]));
}
}
@@ -207,14 +207,14 @@ protected function _open($mode)
*
* @param string $data
* @return void
- * @throws MagentoException
+ * @throws LocalizedException
*/
protected function _write($data)
{
$result = @fwrite($this->_fileHandler, $data);
if (false === $result) {
- throw new MagentoException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]));
+ throw new LocalizedException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath]));
}
}
@@ -223,14 +223,14 @@ protected function _write($data)
*
* @param int $length
* @return string
- * @throws MagentoException
+ * @throws LocalizedException
*/
protected function _read($length)
{
$result = fread($this->_fileHandler, $length);
if (false === $result) {
- throw new MagentoException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('Failed to read data from %1', [$this->_filePath])
);
}
@@ -284,12 +284,12 @@ protected function _isReadableMode($mode)
* Check whether file is opened
*
* @return void
- * @throws MagentoException
+ * @throws LocalizedException
*/
protected function _checkFileOpened()
{
if (!$this->_fileHandler) {
- throw new MagentoException(new \Magento\Framework\Phrase('File not opened'));
+ throw new LocalizedException(new \Magento\Framework\Phrase('File not opened'));
}
}
}
diff --git a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
index ac5f33263ec03..938cfe6a31ec2 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php
@@ -985,7 +985,7 @@ public function insertFromSelect(\Magento\Framework\DB\Select $select, $table, a
* @param \Magento\Framework\DB\Select $select
* @param int $stepCount
* @return \Magento\Framework\DB\Select[]
- * @throws \Magento\Framework\DB\DBException
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100);
diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
index f3bf8e12d893c..b4b07cd12e814 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
@@ -18,6 +18,7 @@
use Magento\Framework\DB\Profiler;
use Magento\Framework\DB\Select;
use Magento\Framework\DB\Statement\Parameter;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Stdlib\DateTime;
use Magento\Framework\Stdlib\String;
@@ -3322,13 +3323,13 @@ public function insertFromSelect(Select $select, $table, array $fields = [], $mo
* @param \Magento\Framework\DB\Select $select
* @param int $stepCount
* @return \Magento\Framework\DB\Select[]
- * @throws \Magento\Framework\DB\DBException
+ * @throws LocalizedException
*/
public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100)
{
$fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM);
if (empty($fromSelect)) {
- throw new \Magento\Framework\DB\DBException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('Select object must have correct "FROM" part')
);
}
@@ -3380,7 +3381,7 @@ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select
* @param Select $select
* @param string|array $table
* @return string
- * @throws \Magento\Framework\DB\DBException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
@@ -3438,7 +3439,7 @@ public function updateFromSelect(Select $select, $table)
}
if (!$columns) {
- throw new \Magento\Framework\DB\DBException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('The columns for UPDATE statement are not defined')
);
}
diff --git a/lib/internal/Magento/Framework/DB/DBException.php b/lib/internal/Magento/Framework/DB/DBException.php
deleted file mode 100644
index 6af4e98427bbf..0000000000000
--- a/lib/internal/Magento/Framework/DB/DBException.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
- */
-class DBException extends \Magento\Framework\Exception\LocalizedException
-{
-}
diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php
index 92e206b069b49..b89a7d646d078 100644
--- a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php
+++ b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php
@@ -93,7 +93,7 @@ public function constructorDataProvider()
'node_data' => null,
'keys' => null,
],
- '\Magento\Framework\DB\Tree\Node\NodeException',
+ '\Magento\Framework\Exception\LocalizedException',
'Empty array of node information',
],
[
@@ -101,7 +101,7 @@ public function constructorDataProvider()
'node_data' => null,
'keys' => true,
],
- '\Magento\Framework\DB\Tree\Node\NodeException',
+ '\Magento\Framework\Exception\LocalizedException',
'Empty array of node information'
],
[
@@ -109,7 +109,7 @@ public function constructorDataProvider()
'node_data' => true,
'keys' => null,
],
- '\Magento\Framework\DB\Tree\Node\NodeException',
+ '\Magento\Framework\Exception\LocalizedException',
'Empty keys array'
]
];
diff --git a/lib/internal/Magento/Framework/DB/Tree.php b/lib/internal/Magento/Framework/DB/Tree.php
index e2449c2bc8498..f06e9d291a894 100644
--- a/lib/internal/Magento/Framework/DB/Tree.php
+++ b/lib/internal/Magento/Framework/DB/Tree.php
@@ -10,13 +10,11 @@
\Zend_Loader::loadClass('\Magento\Framework\DB\Tree\NodeSet');
use Magento\Framework\DB\Tree\Node;
use Magento\Framework\DB\Tree\NodeSet;
-use Magento\Framework\DB\Tree\TreeException;
+use Magento\Framework\Exception\LocalizedException;
/**
* Magento Library
- */
-require_once 'Tree/TreeException.php';
-/**
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Tree
@@ -79,7 +77,7 @@ class Tree
/**
* @param array $config
- * @throws TreeException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
@@ -97,7 +95,7 @@ public function __construct($config = [])
// make sure it's a \Zend_Db_Adapter
if (!$connection instanceof \Zend_Db_Adapter_Abstract) {
- throw new TreeException(
+ throw new LocalizedException(
new \Magento\Framework\Phrase('db object does not implement \Zend_Db_Adapter_Abstract')
);
}
@@ -109,7 +107,7 @@ public function __construct($config = [])
$conn->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
}
} else {
- throw new TreeException(new \Magento\Framework\Phrase('db object is not set in config'));
+ throw new LocalizedException(new \Magento\Framework\Phrase('db object is not set in config'));
}
if (!empty($config['table'])) {
diff --git a/lib/internal/Magento/Framework/DB/Tree/Node.php b/lib/internal/Magento/Framework/DB/Tree/Node.php
index e9ea215876818..f3e353ba81a4d 100644
--- a/lib/internal/Magento/Framework/DB/Tree/Node.php
+++ b/lib/internal/Magento/Framework/DB/Tree/Node.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Framework\DB\Tree;
-use Magento\Framework\DB\Tree\Node\NodeException;
+use Magento\Framework\Exception\LocalizedException;
/**
* @SuppressWarnings(PHPMD.UnusedPrivateField)
@@ -60,15 +60,15 @@ class Node
/**
* @param array $nodeData
* @param array $keys
- * @throws NodeException
+ * @throws LocalizedException
*/
public function __construct($nodeData, $keys)
{
if (empty($nodeData)) {
- throw new NodeException(new \Magento\Framework\Phrase('Empty array of node information'));
+ throw new LocalizedException(new \Magento\Framework\Phrase('Empty array of node information'));
}
if (empty($keys)) {
- throw new NodeException(new \Magento\Framework\Phrase('Empty keys array'));
+ throw new LocalizedException(new \Magento\Framework\Phrase('Empty keys array'));
}
$this->id = $nodeData[$keys['id']];
diff --git a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php b/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php
deleted file mode 100644
index 6f3fa5edae5e2..0000000000000
--- a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php
+++ /dev/null
@@ -1,10 +0,0 @@
-_error = self::ERROR_EMPTY_HOST;
- throw new IoException(new \Magento\Framework\Phrase('Empty host specified'));
+ throw new LocalizedException(new Phrase('Empty host specified'));
}
if (empty($args['port'])) {
@@ -107,22 +110,20 @@ public function open(array $args = [])
}
if (!$this->_conn) {
$this->_error = self::ERROR_INVALID_CONNECTION;
- throw new IoException(
- new \Magento\Framework\Phrase('Could not establish FTP connection, invalid host or port')
- );
+ throw new LocalizedException(new Phrase('Could not establish FTP connection, invalid host or port'));
}
if (!@ftp_login($this->_conn, $this->_config['user'], $this->_config['password'])) {
$this->_error = self::ERROR_INVALID_LOGIN;
$this->close();
- throw new IoException(new \Magento\Framework\Phrase('Invalid user name or password'));
+ throw new LocalizedException(new Phrase('Invalid user name or password'));
}
if (!empty($this->_config['path'])) {
if (!@ftp_chdir($this->_conn, $this->_config['path'])) {
$this->_error = self::ERROR_INVALID_PATH;
$this->close();
- throw new IoException(new \Magento\Framework\Phrase('Invalid path'));
+ throw new LocalizedException(new Phrase('Invalid path'));
}
}
@@ -130,7 +131,7 @@ public function open(array $args = [])
if (!@ftp_pasv($this->_conn, true)) {
$this->_error = self::ERROR_INVALID_MODE;
$this->close();
- throw new IoException(new \Magento\Framework\Phrase('Invalid file transfer mode'));
+ throw new LocalizedException(new Phrase('Invalid file transfer mode'));
}
}
diff --git a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php b/lib/internal/Magento/Framework/Filesystem/Io/IoException.php
deleted file mode 100644
index 3d94334dcae56..0000000000000
--- a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php
+++ /dev/null
@@ -1,14 +0,0 @@
-blockName = $blockName;
+ }
+
+ /**
+ * Throws an exception when parent block calls corrupted child block method
+ *
+ * @param string $method
+ * @param array $args
+ * @return void
+ * @throws LocalizedException
+ */
+ public function __call($method, $args)
+ {
+ throw new LocalizedException(
+ new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName])
+ );
+ }
+
+ /**
+ * Declared in BlockInterface and also throws an exception
+ *
+ * @throws LocalizedException
+ * @return void
+ */
+ public function toHtml()
+ {
+ throw new LocalizedException(
+ new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName])
+ );
+ }
+}
diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php
new file mode 100644
index 0000000000000..522324c0ea22d
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php
@@ -0,0 +1,48 @@
+objectManager = $objectManager;
+ $this->instanceName = $instanceName;
+ }
+
+ /**
+ * Create exception handling block
+ *
+ * @param array $data
+ * @return \Magento\Framework\View\Element\BlockInterface
+ */
+ public function create(array $data = [])
+ {
+ return $this->objectManager->create($this->instanceName, $data);
+ }
+}
diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php
index c2184cfff688e..6c857548d18ed 100644
--- a/lib/internal/Magento/Framework/View/Layout.php
+++ b/lib/internal/Magento/Framework/View/Layout.php
@@ -148,9 +148,9 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra
/**
* @param Layout\ProcessorFactory $processorFactory
- * @param \Magento\Framework\Event\ManagerInterface $eventManager
+ * @param ManagerInterface $eventManager
* @param Layout\Data\Structure $structure
- * @param \Magento\Framework\Message\ManagerInterface $messageManager
+ * @param MessageManagerInterface $messageManager
* @param Design\Theme\ResolverInterface $themeResolver
* @param Layout\ReaderPool $readerPool
* @param Layout\GeneratorPool $generatorPool
@@ -458,14 +458,7 @@ public function renderElement($name, $useCache = true)
{
$this->build();
if (!isset($this->_renderElementCache[$name]) || !$useCache) {
- if ($this->isUiComponent($name)) {
- $result = $this->_renderUiComponent($name);
- } elseif ($this->isBlock($name)) {
- $result = $this->_renderBlock($name);
- } else {
- $result = $this->_renderContainer($name);
- }
- $this->_renderElementCache[$name] = $result;
+ $this->_renderElementCache[$name] = $this->renderNonCachedElement($name);
}
$this->_renderingOutput->setData('output', $this->_renderElementCache[$name]);
$this->_eventManager->dispatch(
@@ -475,6 +468,24 @@ public function renderElement($name, $useCache = true)
return $this->_renderingOutput->getData('output');
}
+ /**
+ * Render non cached element
+ *
+ * @param string $name
+ * @return string
+ */
+ public function renderNonCachedElement($name)
+ {
+ if ($this->isUiComponent($name)) {
+ $result = $this->_renderUiComponent($name);
+ } elseif ($this->isBlock($name)) {
+ $result = $this->_renderBlock($name);
+ } else {
+ $result = $this->_renderContainer($name);
+ }
+ return $result;
+ }
+
/**
* Gets HTML of block element
*
diff --git a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php
index 1bd30ebe9ca8c..d6b0a5b5a11f3 100644
--- a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php
+++ b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Framework\View\Layout\Generator;
+use Magento\Framework\App\State;
use Magento\Framework\ObjectManager\Config\Reader\Dom;
use Magento\Framework\View\Layout;
@@ -49,6 +50,16 @@ class Block implements Layout\GeneratorInterface
*/
protected $scopeResolver;
+ /**
+ * @var State
+ */
+ protected $appState;
+
+ /**
+ * @var \Magento\Framework\View\Element\ExceptionHandlerBlock
+ */
+ protected $exceptionHandlerBlockFactory;
+
/**
* @param \Magento\Framework\View\Element\BlockFactory $blockFactory
* @param \Magento\Framework\Data\Argument\InterpreterInterface $argumentInterpreter
@@ -56,6 +67,8 @@ class Block implements Layout\GeneratorInterface
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver
+ * @param \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory
+ * @param State $appState
*/
public function __construct(
\Magento\Framework\View\Element\BlockFactory $blockFactory,
@@ -63,7 +76,9 @@ public function __construct(
\Magento\Framework\Event\ManagerInterface $eventManager,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
- \Magento\Framework\App\ScopeResolverInterface $scopeResolver
+ \Magento\Framework\App\ScopeResolverInterface $scopeResolver,
+ \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory,
+ State $appState
) {
$this->blockFactory = $blockFactory;
$this->argumentInterpreter = $argumentInterpreter;
@@ -71,6 +86,8 @@ public function __construct(
$this->logger = $logger;
$this->scopeConfig = $scopeConfig;
$this->scopeResolver = $scopeResolver;
+ $this->exceptionHandlerBlockFactory = $exceptionHandlerBlockFactory;
+ $this->appState = $appState;
}
/**
@@ -89,6 +106,7 @@ public function getType()
* @param Layout\Reader\Context $readerContext
* @param Context $generatorContext
* @return $this
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function process(Layout\Reader\Context $readerContext, Layout\Generator\Context $generatorContext)
{
@@ -102,34 +120,72 @@ public function process(Layout\Reader\Context $readerContext, Layout\Generator\C
foreach ($scheduledStructure->getElements() as $elementName => $element) {
list($type, $data) = $element;
if ($type === self::TYPE) {
- $block = $this->generateBlock($scheduledStructure, $structure, $elementName);
- $blocks[$elementName] = $block;
- $layout->setBlock($elementName, $block);
- if (!empty($data['actions'])) {
- $blockActions[$elementName] = $data['actions'];
+ try {
+ $block = $this->generateBlock($scheduledStructure, $structure, $elementName);
+ $blocks[$elementName] = $block;
+ $layout->setBlock($elementName, $block);
+ if (!empty($data['actions'])) {
+ $blockActions[$elementName] = $data['actions'];
+ }
+ } catch (\Exception $e) {
+ $this->handleRenderException($e);
+ unset($blocks[$elementName]);
}
}
}
// Set layout instance to all generated block (trigger _prepareLayout method)
foreach ($blocks as $elementName => $block) {
- $block->setLayout($layout);
- $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]);
+ try {
+ $block->setLayout($layout);
+ $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]);
+ } catch (\Exception $e) {
+ $this->handleRenderException($e);
+ $layout->setBlock(
+ $elementName,
+ $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName])
+ );
+ unset($blockActions[$elementName]);
+ }
$scheduledStructure->unsetElement($elementName);
}
// Run all actions after layout initialization
foreach ($blockActions as $elementName => $actions) {
- foreach ($actions as $action) {
- list($methodName, $actionArguments, $configPath, $scopeType) = $action;
- if (empty($configPath)
- || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope())
- ) {
- $this->generateAction($blocks[$elementName], $methodName, $actionArguments);
+ try {
+ foreach ($actions as $action) {
+ list($methodName, $actionArguments, $configPath, $scopeType) = $action;
+ if (empty($configPath)
+ || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope())
+ ) {
+ $this->generateAction($blocks[$elementName], $methodName, $actionArguments);
+ }
}
+ } catch (\Exception $e) {
+ $this->handleRenderException($e);
+ $layout->setBlock(
+ $elementName,
+ $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName])
+ );
}
}
return $this;
}
+ /**
+ * Handle exceptions during rendering process
+ *
+ * @param \Exception $cause
+ * @throws \Exception
+ * @return void
+ */
+ protected function handleRenderException(\Exception $cause)
+ {
+ if ($this->appState->getMode() === State::MODE_DEVELOPER) {
+ throw $cause;
+ }
+ $message = ($cause instanceof LocalizedException) ? $cause->getLogMessage() : $cause->getMessage();
+ $this->logger->critical($message);
+ }
+
/**
* Create block and set related data
*
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php
index 7679ac3d2846e..45effcf449e43 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php
@@ -26,11 +26,6 @@ class LayoutTest extends \PHPUnit_Framework_TestCase
*/
protected $processorFactoryMock;
- /**
- * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $appStateMock;
-
/**
* @var \Magento\Framework\View\Design\Theme\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject
*/