public function JsonUtility::translateError in Feeds extensible parsers 8
Translates an error message.
Parameters
int $error: The JSON error.
Return value
string The JSON parsing error message.
File
- src/
Utility/ JsonUtility.php, line 24
Class
- JsonUtility
- Various helpers for handling JSON.
Namespace
Drupal\feeds_ex\UtilityCode
public function translateError($error) {
switch ($error) {
case JSON_ERROR_RECURSION:
return 'One or more recursive references in the value to be encoded';
case JSON_ERROR_INF_OR_NAN:
return 'One or more NAN or INF values in the value to be encoded';
case JSON_ERROR_UNSUPPORTED_TYPE:
return 'A value of a type that cannot be encoded was given';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
case JSON_ERROR_NONE:
return 'No error has occurred';
case JSON_ERROR_DEPTH:
return 'The maximum stack depth has been exceeded';
case JSON_ERROR_STATE_MISMATCH:
return 'Invalid or malformed JSON';
case JSON_ERROR_CTRL_CHAR:
return 'Control character error, possibly incorrectly encoded';
case JSON_ERROR_SYNTAX:
return 'Syntax error';
default:
return 'Unknown error';
}
}