Skip to content

Commit f1e6e85

Browse files
authored
ENGCOM-3940: [Backport] Added required error message. #20509
2 parents c5727bb + 762e0d5 commit f1e6e85

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@
1616
class Json implements SerializerInterface
1717
{
1818
/**
19-
* {@inheritDoc}
19+
* @inheritDoc
2020
* @since 100.2.0
2121
*/
2222
public function serialize($data)
2323
{
2424
$result = json_encode($data);
2525
if (false === $result) {
26-
throw new \InvalidArgumentException('Unable to serialize value.');
26+
throw new \InvalidArgumentException("Unable to serialize value. Error: " . json_last_error_msg());
2727
}
2828
return $result;
2929
}
3030

3131
/**
32-
* {@inheritDoc}
32+
* @inheritDoc
3333
* @since 100.2.0
3434
*/
3535
public function unserialize($string)
3636
{
3737
$result = json_decode($string, true);
3838
if (json_last_error() !== JSON_ERROR_NONE) {
39-
throw new \InvalidArgumentException('Unable to unserialize value.');
39+
throw new \InvalidArgumentException("Unable to unserialize value. Error: " . json_last_error_msg());
4040
}
4141
return $result;
4242
}

0 commit comments

Comments
 (0)