Skip to content

Commit 9fa2765

Browse files
mpchadwickihor-sviziev
authored andcommitted
Log exceptions
This would happen if for some reason the area code wasn't set
1 parent 630ea11 commit 9fa2765

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/code/Magento/NewRelicReporting/Plugin/StatePlugin.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\Exception\LocalizedException;
1010
use Magento\NewRelicReporting\Model\Config;
1111
use Magento\NewRelicReporting\Model\NewRelicWrapper;
12+
use Psr\Log\LoggerInterface;
1213

1314
class StatePlugin
1415
{
@@ -22,16 +23,23 @@ class StatePlugin
2223
*/
2324
private $newRelicWrapper;
2425

26+
/**
27+
* @var LoggerInterface
28+
*/
29+
private $logger;
30+
2531
/**
2632
* @param Config $config
2733
* @param NewRelicWrapper $newRelicWrapper
2834
*/
2935
public function __construct(
3036
Config $config,
31-
NewRelicWrapper $newRelicWrapper
37+
NewRelicWrapper $newRelicWrapper,
38+
LoggerInterface $logger
3239
) {
3340
$this->config = $config;
3441
$this->newRelicWrapper = $newRelicWrapper;
42+
$this->logger = $logger;
3543
}
3644

3745
/**
@@ -52,6 +60,7 @@ public function afterSetAreaCode(State $state, $result)
5260
try {
5361
$this->newRelicWrapper->setAppName($this->appName($state));
5462
} catch (LocalizedException $e) {
63+
$this->logger->critical($e);
5564
return;
5665
}
5766
}

0 commit comments

Comments
 (0)