Skip to content

Commit 6d59375

Browse files
author
Yurii Torbyk
committed
MAGETWO-34991: Eliminate exceptions from the list Part2
1 parent 4978cab commit 6d59375

File tree

159 files changed

+638
-447
lines changed

Some content is hidden

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

159 files changed

+638
-447
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Design/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function execute()
2020
try {
2121
$design->delete();
2222
$this->messageManager->addSuccess(__('You deleted the design change.'));
23-
} catch (\Magento\Framework\Exception $e) {
23+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
2424
$this->messageManager->addError($e->getMessage());
2525
} catch (\Exception $e) {
2626
$this->messageManager->addException($e, __("Cannot delete the design change."));

app/code/Magento/Backend/Model/Menu/Config/Menu/Dom.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class Dom extends \Magento\Framework\Config\Dom
1515
*
1616
* @param string $nodePath
1717
* @return \DOMElement|null
18-
* @throws \Magento\Framework\Exception an exception is possible if original document contains multiple fixed nodes
18+
* @throws \Magento\Framework\Exception\LocalizedException an exception is possible if original document contains
19+
* multiple fixed nodes
1920
*/
2021
protected function _getMatchedNode($nodePath)
2122
{

app/code/Magento/Backend/Test/Unit/Model/Menu/ItemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function testIsAllowedReturnsFalseIfResourceIsNotAvailable()
208208
)->with(
209209
'Magento_Config::config'
210210
)->will(
211-
$this->throwException(new \Magento\Framework\Exception())
211+
$this->throwException(new \Magento\Framework\Exception\LocalizedException(__('Error')))
212212
);
213213
$this->assertFalse($this->_model->isAllowed());
214214
}

app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function execute()
4444
}
4545

4646
if (!$backup->getTime()) {
47-
throw new \Magento\Framework\Backup\Exception\CantLoadSnapshot();
47+
throw new \Magento\Framework\Backup\Exception\CantLoadSnapshot(__('Can\'t load snapshot archive'));
4848
}
4949

5050
$type = $backup->getType();

app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ public function execute()
7474
->updateAttributes($productIds, ['status' => $status], $storeId);
7575
$this->messageManager->addSuccess(__('A total of %1 record(s) have been updated.', count($productIds)));
7676
$this->_productPriceIndexerProcessor->reindexList($productIds);
77-
} catch (\Magento\Framework\Exception $e) {
78-
$this->messageManager->addError($e->getMessage());
7977
} catch (\Magento\Framework\Exception\LocalizedException $e) {
8078
$this->messageManager->addError($e->getMessage());
8179
} catch (\Exception $e) {

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction
1717
* @param null|array $ids
1818
*
1919
* @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Full
20-
* @throws \Magento\Framework\Exception
20+
* @throws \Magento\Framework\Exception\LocalizedException
2121
* @throws \Exception
2222
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2323
*/

app/code/Magento/Cms/Block/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function _prepareLayout()
118118
* Prepare breadcrumbs
119119
*
120120
* @param \Magento\Cms\Model\Page $page
121-
* @throws \Magento\Framework\Exception
121+
* @throws \Magento\Framework\Exception\LocalizedException
122122
* @return void
123123
*/
124124
protected function _addBreadcrumbs(\Magento\Cms\Model\Page $page)

app/code/Magento/Customer/Test/Unit/Block/Address/EditTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function testSetLayoutWithOwnAddressAndPostedData()
166166
}
167167

168168
/**
169-
* @throws \Magento\Framework\Exception
169+
* @throws \Magento\Framework\Exception\LocalizedException
170170
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
171171
*/
172172
public function testSetLayoutWithAlienAddress()

app/code/Magento/Customer/Test/Unit/Model/Resource/Group/Grid/ServiceCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function testGetSearchCriteriaAnd()
217217
* @param string[] $fields
218218
* @param array $conditions
219219
*
220-
* @expectedException \Magento\Framework\Exception
220+
* @expectedException \Magento\Framework\Exception\LocalizedException
221221
* @expectedExceptionMessage When passing in a field array there must be a matching condition array
222222
* @dataProvider addFieldToFilterInconsistentArraysDataProvider
223223
*/

app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function _prepareForm()
8989
\Magento\DesignEditor\Model\Editor\Tools\Controls\Factory::TYPE_IMAGE_SIZING,
9090
$this->_themeContext->getStagingTheme()
9191
);
92-
} catch (\Magento\Framework\Exception $e) {
92+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
9393
$isFilePresent = false;
9494
}
9595

0 commit comments

Comments
 (0)