3 namespace Doctrine\CouchDB
;
5 class JsonDecodeException
extends \Exception
7 static public function fromLastJsonError()
9 $lastError = \
json_last_error();
11 case \JSON_ERROR_DEPTH
:
12 return new self("The maximum stack depth has been exceeded");
13 case \JSON_ERROR_STATE_MISMATCH
:
14 return new self("Invalid or malformed JSON");
15 case \JSON_ERROR_CTRL_CHAR
:
16 return new self("Control character error, possibly incorrectly encoded");
17 case \JSON_ERROR_SYNTAX
:
18 return new self("Syntax error");
20 return new self("An unknownerror occured with code: " . $lastError);