Skip to content

Commit 4a815b5

Browse files
committed
[FIX] - repositioned the appstate to the isProductionMode method
1 parent cf645bf commit 4a815b5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Helper/Data.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Framework\App\Helper\Context;
99
use Magento\Store\Model\StoreManagerInterface;
1010
use Magento\Framework\App\Helper\AbstractHelper;
11+
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\App\ProductMetadataInterface;
1213

1314
class Data extends AbstractHelper
@@ -102,13 +103,6 @@ public function collectModuleConfig()
102103
*/
103104
public function isActive()
104105
{
105-
try {
106-
$this->appState->setAreaCode(Area::AREA_GLOBAL);
107-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
108-
// intentionally left empty
109-
// var_dump($e);
110-
}
111-
112106
return (! empty($this->config) && array_key_exists('enabled', $this->config) && $this->config['enabled'] && ($this->isProductionMode() || $this->isOverwriteProductionMode()));
113107
}
114108

@@ -117,6 +111,12 @@ public function isActive()
117111
*/
118112
public function isProductionMode()
119113
{
114+
try {
115+
$this->appState->setAreaCode(Area::AREA_GLOBAL);
116+
} catch (LocalizedException $e) {
117+
//intentionally left empty
118+
}
119+
120120
return $this->getAppState() == 'production';
121121
}
122122

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "justbetter/magento2-sentry",
33
"description": "Magento 2 Logger for Sentry",
44
"type": "magento2-module",
5-
"version": "0.4.2",
5+
"version": "0.4.3",
66
"license": "MIT",
77
"require": {
88
"php": ">=7.0",

0 commit comments

Comments
 (0)