Skip to content

Commit dfd8de3

Browse files
author
Dmytro Poperechnyy
committed
MAGETWO-33814: Change parent class of Model\Exception sub-classes to Localized
- Changed parent class of Model\Exception children to LocalizedException; - Framework\Model\Exception deleted;
1 parent 3e8d990 commit dfd8de3

File tree

23 files changed

+30
-133
lines changed

23 files changed

+30
-133
lines changed

app/code/Magento/Backend/Model/Auth.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,15 @@ public function isLoggedIn()
197197
* Throws specific Backend Authentication \Exception
198198
*
199199
* @param string $msg
200-
* @param string $code
201200
* @return void
202201
* @throws \Magento\Backend\Model\Auth\Exception
203202
* @static
204203
*/
205-
public static function throwException($msg = null, $code = null)
204+
public static function throwException($msg = null)
206205
{
207206
if (is_null($msg)) {
208207
$msg = __('Authentication error occurred.');
209208
}
210-
throw new \Magento\Backend\Model\Auth\Exception($msg, $code);
209+
throw new \Magento\Backend\Model\Auth\Exception($msg);
211210
}
212211
}

app/code/Magento/Backend/Model/Auth/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
*
1111
* @author Magento Core Team <core@magentocommerce.com>
1212
*/
13-
class Exception extends \Magento\Framework\Model\Exception
13+
class Exception extends \Magento\Framework\Exception\LocalizedException
1414
{
1515
}

app/code/Magento/Catalog/Model/Product/AttributeSet/AlreadyExistsException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\AttributeSet;
88

9-
class AlreadyExistsException extends \Magento\Framework\Model\Exception
9+
class AlreadyExistsException extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getAttributeSet()
7878
$attributeSet = $this->attributeSetFactory->create();
7979
$attributeSet->setEntityTypeId($this->entityTypeId)->load($this->name, 'attribute_set_name');
8080
if ($attributeSet->getId()) {
81-
throw new AlreadyExistsException();
81+
throw new AlreadyExistsException(__('Attribute set already exists.'));
8282
}
8383

8484
$attributeSet->setAttributeSetName($this->name)->validate();

app/code/Magento/Catalog/Model/Product/Option/Type/File/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9-
class Exception extends \Magento\Framework\Model\Exception
9+
class Exception extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/Option/Type/File/LargeSizeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9-
class LargeSizeException extends \Magento\Framework\Model\Exception
9+
class LargeSizeException extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/Option/Type/File/NotImageException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9-
class NotImageException extends \Magento\Framework\Model\Exception
9+
class NotImageException extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/Option/Type/File/OptionRequiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9-
class OptionRequiredException extends \Magento\Framework\Model\Exception
9+
class OptionRequiredException extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/Option/Type/File/RunValidationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
namespace Magento\Catalog\Model\Product\Option\Type\File;
88

9-
class RunValidationException extends \Magento\Framework\Model\Exception
9+
class RunValidationException extends \Magento\Framework\Exception\LocalizedException
1010
{
1111
}

app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function buildImageValidator($object, $option, $fileFullPath = null)
139139
}
140140
if (count($dimensions) > 0) {
141141
if (!is_null($fileFullPath) && !$this->isImage($fileFullPath)) {
142-
throw new NotImageException();
142+
throw new NotImageException(__('This is not an image.'));
143143
}
144144
$object->addValidator(new \Zend_Validate_File_ImageSize($dimensions));
145145
}

0 commit comments

Comments
 (0)