composer package updates
[openemr.git] / vendor / doctrine / couchdb / lib / Doctrine / CouchDB / JsonDecodeException.php
blob1f73d1660dc7d48b1ecd62e648b1450094e6e281
1 <?php
3 namespace Doctrine\CouchDB;
5 class JsonDecodeException extends \Exception
7 static public function fromLastJsonError()
9 $lastError = \json_last_error();
10 switch ($lastError) {
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");
19 default:
20 return new self("An unknownerror occured with code: " . $lastError);