Skip to content

Commit 7df5394

Browse files
ENGCOM-3940: [Backport] Added required error message. #20509
- Merge Pull Request #20509 from mageprince/magento2:2.2-develop-PR-port-19870 - Merged commits: 1. ce11dd1 2. a10e313 3. b14ad81 4. 6235266 5. fc67582 6. aea6e3b 7. c0d6a65
2 parents 8fdae10 + c0d6a65 commit 7df5394

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)