public static function FeedsExJsonUtility::translateError in Feeds extensible parsers 7.2
Same name and namespace in other branches
- 7 src/Json/Utility.php \FeedsExJsonUtility::translateError()
Translates an error message.
Parameters
int $error: The JSON error.
Return value
string The JSON parsing error message.
2 calls to FeedsExJsonUtility::translateError()
- FeedsExJmesPath::getErrors in src/
FeedsExJmesPath.inc - Returns the errors after parsing.
- FeedsExJsonPath::getErrors in src/
FeedsExJsonPath.inc - Returns the errors after parsing.
File
- src/
Json/ Utility.php, line 22 - Contains FeedsExJsonUtility.
Class
- FeedsExJsonUtility
- Various helpers for handling JSON.
Code
public static function translateError($error) {
switch ($error) {
case JSON_ERROR_NONE:
return;
case JSON_ERROR_DEPTH:
return 'Maximum stack depth exceeded';
case JSON_ERROR_STATE_MISMATCH:
return 'Underflow or the modes mismatch';
case JSON_ERROR_CTRL_CHAR:
return 'Unexpected control character found';
case JSON_ERROR_SYNTAX:
return 'Syntax error, malformed JSON';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
default:
return 'Unknown error';
}
}