Skip to content

Commit 59ad154

Browse files
AC-988::Resolving static test warnings
1 parent 630001d commit 59ad154

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@
1111
*/
1212
namespace Magento\Cron\Model\Config\Backend\Product;
1313

14+
use Magento\Framework\Exception\LocalizedException;
15+
1416
/**
1517
* Cron job Alert configuration
1618
*/
1719
class Alert extends \Magento\Framework\App\Config\Value
1820
{
1921
/**
20-
* Cron string path
22+
* Cron string path for product alerts
2123
*/
2224
const CRON_STRING_PATH = 'crontab/default/jobs/catalog_product_alert/schedule/cron_expr';
2325

2426
/**
25-
* Cron model path
27+
* Cron model path for product alerts
2628
*/
2729
const CRON_MODEL_PATH = 'crontab/default/jobs/catalog_product_alert/run/model';
2830

@@ -67,7 +69,7 @@ public function __construct(
6769
* @inheritdoc
6870
*
6971
* @return $this
70-
* @throws \Exception
72+
* @throws LocalizedException
7173
*/
7274
public function afterSave()
7375
{
@@ -102,7 +104,7 @@ public function afterSave()
102104
self::CRON_MODEL_PATH
103105
)->save();
104106
} catch (\Exception $e) {
105-
throw new \Exception(__('We can\'t save the cron expression.'));
107+
throw new LocalizedException(__('We can\'t save the cron expression.'));
106108
}
107109

108110
return parent::afterSave();

app/code/Magento/Cron/Model/Config/Backend/Sitemap.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
*/
1212
namespace Magento\Cron\Model\Config\Backend;
1313

14+
use Magento\Framework\Exception\LocalizedException;
15+
1416
/**
1517
* Sitemap configuration
1618
*/
1719
class Sitemap extends \Magento\Framework\App\Config\Value
1820
{
1921
/**
20-
* Cron string path
22+
* Cron string path for product alerts
2123
*/
2224
const CRON_STRING_PATH = 'crontab/default/jobs/sitemap_generate/schedule/cron_expr';
2325

@@ -67,7 +69,7 @@ public function __construct(
6769
* After save handler
6870
*
6971
* @return $this
70-
* @throws \Exception
72+
* @throws LocalizedException
7173
*/
7274
public function afterSave()
7375
{
@@ -102,7 +104,7 @@ public function afterSave()
102104
self::CRON_MODEL_PATH
103105
)->save();
104106
} catch (\Exception $e) {
105-
throw new \Exception(__('We can\'t save the cron expression.'));
107+
throw new LocalizedException(__('We can\'t save the cron expression.'));
106108
}
107109
return parent::afterSave();
108110
}

0 commit comments

Comments
 (0)