protected static function handleJsonError($lastError)
{
if ($lastError === JSON_ERROR_NONE) {
return;
}
$availableErrors = [];
foreach (static::$jsonErrorMessages as $const => $message) {
if (defined($const)) {
$availableErrors[constant($const)] = $message;
}
}
if (isset($availableErrors[$lastError])) {
throw new InvalidParamException($availableErrors[$lastError], $lastError);
}
throw new InvalidParamException('Unknown JSON encoding/decoding error.');
}