First Local Commit - After Clean up.
Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
41
system/Exceptions/CastException.php
Normal file
41
system/Exceptions/CastException.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php namespace CodeIgniter\Exceptions;
|
||||
|
||||
/**
|
||||
* Cast Exceptions.
|
||||
*/
|
||||
|
||||
class CastException extends CriticalError
|
||||
{
|
||||
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $code = 3;
|
||||
|
||||
public static function forInvalidJsonFormatException(int $error)
|
||||
{
|
||||
switch($error)
|
||||
{
|
||||
case JSON_ERROR_DEPTH:
|
||||
throw new static(lang('Cast.jsonErrorDepth'));
|
||||
break;
|
||||
case JSON_ERROR_STATE_MISMATCH:
|
||||
throw new static(lang('Cast.jsonErrorStateMismatch'));
|
||||
break;
|
||||
case JSON_ERROR_CTRL_CHAR:
|
||||
throw new static(lang('Cast.jsonErrorCtrlChar'));
|
||||
break;
|
||||
case JSON_ERROR_SYNTAX:
|
||||
throw new static(lang('Cast.jsonErrorSyntax'));
|
||||
break;
|
||||
case JSON_ERROR_UTF8:
|
||||
throw new static(lang('Cast.jsonErrorUtf8'));
|
||||
break;
|
||||
default:
|
||||
throw new static(lang('Cast.jsonErrorUnknown'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user