secure-custom-fields
/
vendor
/
justinrainbow
/
json-schema
/
src
/
JsonSchema
/
Exception
/
JsonDecodingException.php
secure-custom-fields
/
vendor
/
justinrainbow
/
json-schema
/
src
/
JsonSchema
/
Exception
Last commit date
ExceptionInterface.php
7 months ago
InvalidArgumentException.php
7 months ago
InvalidConfigException.php
7 months ago
InvalidSchemaException.php
7 months ago
InvalidSchemaMediaTypeException.php
7 months ago
InvalidSourceUriException.php
7 months ago
JsonDecodingException.php
7 months ago
ResourceNotFoundException.php
7 months ago
RuntimeException.php
7 months ago
UnresolvableJsonPointerException.php
7 months ago
UriResolverException.php
7 months ago
ValidationException.php
7 months ago
JsonDecodingException.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the JsonSchema package. |
| 5 | * |
| 6 | * For the full copyright and license information, please view the LICENSE |
| 7 | * file that was distributed with this source code. |
| 8 | */ |
| 9 | |
| 10 | namespace JsonSchema\Exception; |
| 11 | |
| 12 | /** |
| 13 | * Wrapper for the JsonDecodingException |
| 14 | */ |
| 15 | class JsonDecodingException extends RuntimeException |
| 16 | { |
| 17 | public function __construct($code = JSON_ERROR_NONE, ?\Exception $previous = null) |
| 18 | { |
| 19 | switch ($code) { |
| 20 | case JSON_ERROR_DEPTH: |
| 21 | $message = 'The maximum stack depth has been exceeded'; |
| 22 | break; |
| 23 | case JSON_ERROR_STATE_MISMATCH: |
| 24 | $message = 'Invalid or malformed JSON'; |
| 25 | break; |
| 26 | case JSON_ERROR_CTRL_CHAR: |
| 27 | $message = 'Control character error, possibly incorrectly encoded'; |
| 28 | break; |
| 29 | case JSON_ERROR_UTF8: |
| 30 | $message = 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
| 31 | break; |
| 32 | case JSON_ERROR_SYNTAX: |
| 33 | $message = 'JSON syntax is malformed'; |
| 34 | break; |
| 35 | default: |
| 36 | $message = 'Syntax error'; |
| 37 | } |
| 38 | parent::__construct($message, $code, $previous); |
| 39 | } |
| 40 | } |
| 41 |