Skip to content

Commit c6be7da

Browse files
committed
MAGETWO-34991: Eliminate exceptions from the list Part2
1 parent 5d7ce3e commit c6be7da

File tree

86 files changed

+346
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+346
-302
lines changed

app/code/Magento/Backup/Model/Backup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function open($write = false)
298298
$this->_getFilePath(),
299299
$mode
300300
);
301-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
301+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
302302
throw new \Magento\Framework\Backup\Exception\NotEnoughPermissions(
303303
__('Sorry, but we cannot read from or write to backup file "%1".', $this->getFileName())
304304
);
@@ -353,7 +353,7 @@ public function write($string)
353353
{
354354
try {
355355
$this->_getStream()->write($string);
356-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
356+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
357357
throw new \Magento\Backup\Exception(
358358
__('Something went wrong writing to the backup file "%1".', $this->getFileName())
359359
);

app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function validate($object)
5353
if (!$validator->isValid($xml)) {
5454
$messages = $validator->getMessages();
5555
//Add first message to exception
56-
$massage = array_shift($messages);
57-
$eavExc = new Exception(__($massage));
56+
$message = array_shift($messages);
57+
$eavExc = new Exception(__($message));
5858
$eavExc->setAttributeCode($attributeName);
5959
throw $eavExc;
6060
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
7979
* @param File\ValidatorInfo $validatorInfo
8080
* @param File\ValidatorFile $validatorFile
8181
* @param array $data
82-
* @throws \Magento\Framework\Exception\FilesystemException
82+
* @throws \Magento\Framework\Exception\FileSystemException
8383
*/
8484
public function __construct(
8585
\Magento\Checkout\Model\Session $checkoutSession,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ValidatorFile extends Validator
6161
* @param \Magento\Framework\Filesystem $filesystem
6262
* @param \Magento\Framework\File\Size $fileSize
6363
* @param \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory
64-
* @throws \Magento\Framework\Exception\FilesystemException
64+
* @throws \Magento\Framework\Exception\FileSystemException
6565
*/
6666
public function __construct(
6767
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ public function processFileQueue()
488488
DirectoryList::ROOT
489489
);
490490
$rootDir->create($rootDir->getRelativePath($path));
491-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
491+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
492492
throw new \Magento\Framework\Exception\LocalizedException(
493493
__('We can\'t create writeable directory "%1".', $path)
494494
);

app/code/Magento/Checkout/Controller/Onepage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use Magento\Customer\Api\AccountManagementInterface;
99
use Magento\Customer\Api\CustomerRepositoryInterface;
10-
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Exception\NotFoundException;
1111
use Magento\Framework\App\RequestInterface;
1212

1313
/**
@@ -141,7 +141,7 @@ public function __construct(
141141
*
142142
* @param RequestInterface $request
143143
* @return \Magento\Framework\App\ResponseInterface
144-
* @throws \Magento\Framework\Exception\NoSuchEntityException
144+
* @throws \Magento\Framework\Exception\NotFoundException
145145
*/
146146
public function dispatch(RequestInterface $request)
147147
{
@@ -158,7 +158,7 @@ public function dispatch(RequestInterface $request)
158158
}
159159

160160
if (!$this->_canShowForUnregisteredUsers()) {
161-
throw new NoSuchEntityException();
161+
throw new NotFoundException(__('Page not found.'));
162162
}
163163
return parent::dispatch($request);
164164
}

app/code/Magento/Cms/Helper/Wysiwyg/Images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function getCurrentPath()
206206
if (!$this->_directory->isExist($currentDir)) {
207207
$this->_directory->create($currentDir);
208208
}
209-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
209+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
210210
$message = __('The directory %1 is not writable by server.', $currentPath);
211211
throw new \Magento\Framework\Exception\LocalizedException($message);
212212
}

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public function createDirectory($name, $path)
375375
'id' => $this->_cmsWysiwygImages->convertPathToId($newPath),
376376
];
377377
return $result;
378-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
378+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
379379
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot create a new directory.'));
380380
}
381381
}
@@ -396,7 +396,7 @@ public function deleteDirectory($path)
396396
$this->_deleteByPath($path);
397397
$path = $this->getThumbnailRoot() . $this->_getRelativePathToRoot($path);
398398
$this->_deleteByPath($path);
399-
} catch (\Magento\Framework\Exception\FilesystemException $e) {
399+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
400400
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot delete directory %1.', $path));
401401
}
402402
}

app/code/Magento/Config/Controller/Adminhtml/System/ConfigSectionChecker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Config\Controller\Adminhtml\System;
88

9-
use Magento\Framework\Exception\NoSuchEntityException;
9+
use Magento\Framework\Exception\NotFoundException;
1010

1111
class ConfigSectionChecker
1212
{
@@ -31,7 +31,7 @@ public function __construct(\Magento\Config\Model\Config\Structure $configStruct
3131
* @param string $sectionId
3232
* @throws \Exception
3333
* @return bool
34-
* @throws NoSuchEntityException
34+
* @throws NotFoundException
3535
*/
3636
public function isSectionAllowed($sectionId)
3737
{
@@ -41,7 +41,7 @@ public function isSectionAllowed($sectionId)
4141
}
4242
return true;
4343
} catch (\Zend_Acl_Exception $e) {
44-
throw new NoSuchEntityException();
44+
throw new NotFoundException(__('Page not found.'));
4545
} catch (\Exception $e) {
4646
return false;
4747
}

app/code/Magento/Contact/Controller/Index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Contact\Controller;
77

8-
use Magento\Framework\Exception\NoSuchEntityException;
8+
use Magento\Framework\Exception\NotFoundException;
99
use Magento\Framework\App\RequestInterface;
1010
use Magento\Store\Model\ScopeInterface;
1111

@@ -80,12 +80,12 @@ public function __construct(
8080
*
8181
* @param RequestInterface $request
8282
* @return \Magento\Framework\App\ResponseInterface
83-
* @throws \Magento\Framework\Exception\NoSuchEntityException
83+
* @throws \Magento\Framework\Exception\NotFoundException
8484
*/
8585
public function dispatch(RequestInterface $request)
8686
{
8787
if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
88-
throw new NoSuchEntityException();
88+
throw new NotFoundException(__('Page not found.'));
8989
}
9090
return parent::dispatch($request);
9191
}

0 commit comments

Comments
 (0)