Skip to content

Commit 47ae451

Browse files
ENGCOM-3782: Added required error message. #19870
- Merge Pull Request #19870 from vinogcs/magento2:2.3-develop - Merged commits: 1. 4d299eb 2. 959beff 3. b2c1890 4. 143120b 5. ac407de 6. 39bf467 7. 49667ee
2 parents b3d9a05 + 49667ee commit 47ae451

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)