Skip to content

Commit fc67582

Browse files
vinogcsmageprince
authored andcommitted
Updated to show error message to all Env.
1 parent 6235266 commit fc67582

File tree

1 file changed

+3
-17
lines changed
  • lib/internal/Magento/Framework/Serialize/Serializer

1 file changed

+3
-17
lines changed

lib/internal/Magento/Framework/Serialize/Serializer/Json.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ public function serialize($data)
2323
{
2424
$result = json_encode($data);
2525
if (false === $result) {
26-
$errorMessage = "Unable to serialize value.";
27-
if(!$this->isOnProduction()){
28-
$errorMessage .= "Error: " . json_last_error_msg();
29-
}
30-
throw new \InvalidArgumentException($errorMessage);
26+
throw new \InvalidArgumentException("Unable to serialize value. Error: " . json_last_error_msg());
3127
}
3228
return $result;
3329
}
@@ -40,18 +36,8 @@ public function unserialize($string)
4036
{
4137
$result = json_decode($string, true);
4238
if (json_last_error() !== JSON_ERROR_NONE) {
43-
$errorMessage = "Unable to unserialize value.";
44-
if(!$this->isOnProduction()){
45-
$errorMessage .= "Error: " . json_last_error_msg();
46-
}
47-
throw new \InvalidArgumentException($errorMessage);
39+
throw new \InvalidArgumentException("Unable to unserialize value. Error: " . json_last_error_msg());
4840
}
4941
return $result;
50-
}
51-
52-
private function isOnProduction(){
53-
$appState = \Magento\Framework\App\ObjectManager::getInstance()
54-
->get('Magento\Framework\App\State');
55-
return $appState === \Magento\Framework\App\State::MODE_PRODUCTION;
56-
}
42+
}
5743
}

0 commit comments

Comments
 (0)