Helper method to create a JSON error.

@param int $errno An error number from json_last_error()

@return void
518184
private static function _handleJsonError($errno)
    {
        $messages = array(
            JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
            JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
            JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
        );
        throw new \DomainException(
            isset($messages[$errno])
            ? $messages[$errno]
            : 'Unknown JSON error: ' . $errno
        );
    }
472625
protected function throwError($errno, $errstr, $errfile, $errline)
        {
            $msg = "";

            switch ($errno) {
                case E_USER_ERROR:
                case E_USER_WARNING:
                    $msg .= "<b>ERROR</b> [$errno] $errstr<br />\n";
                    $msg .= "  Fatal error on line $errline in file $errfile";
                    $msg .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
                    $msg .= "Aborting...<br />\n";

                    throw new Exception($msg);
                    //exit(1);
                break;

                case E_USER_NOTICE:
                default:
            }

            // Don't execute PHP internal error handler
            return true;
        }
582094
public static function errorHandler($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)
    {
        return true;
    }
1033660
static function errorHandler($errno, $errstr, $errfile, $errline) {
	    switch ($errno) {
	    case E_USER_ERROR:
	        echo "<b>ERROR:</b> [$errno] $errstr<br>
	        <b>File: </b>$errfile [$errline]<br>
	        Aborting...<br>";
	        exit(1);
	        break;

	    case E_USER_WARNING:
	        echo "<b>WARNING:</b> [$errno] $errstr<br><b>File:</b> $errfile [$errline]";
	        break;

	    case E_USER_NOTICE:
	        echo "<b>NOTICE:</b> [$errno] $errstr<br><b>File:</b> $errfile [$errline]";
	        break;

	    default:
	        echo "<b>Unknown error type:</b> [$errno] $errstr<br><b>File:</b> $errfile [$errline]";
	        break;
	    }

	    /* Don't execute PHP internal error handler */
	    return true;
	}
916184
private static function catchError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                self::$error = false;
                break;
            case JSON_ERROR_DEPTH:
                self::$error = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                self::$error = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                self::$error = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                self::$error = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                self::$error = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                self::$error = 'Unknown error';
                break;
        }
    }
1037637
protected function handleJsonError()
    {
        if (function_exists('json_last_error_msg') && json_last_error() !== JSON_ERROR_NONE) {
            // PHP >= 5.5.0
            $message = json_last_error_msg();

        } elseif (function_exists('json_last_error')) {
            // PHP >= 5.3.0
            switch (json_last_error()) {
                case JSON_ERROR_NONE:
                    break;
                case JSON_ERROR_DEPTH:
                    $message = 'maximum stack depth exceeded';
                    break;
                case JSON_ERROR_STATE_MISMATCH:
                    $message = 'underflow or the modes mismatch';
                    break;
                case JSON_ERROR_CTRL_CHAR:
                    $message = 'unexpected control character found';
                    break;
                case JSON_ERROR_SYNTAX:
                    $message = 'malformed JSON';
                    break;
                case JSON_ERROR_UTF8:
                    $message = 'malformed UTF-8 characters, possibly ' .
                        'incorrectly encoded';
                    break;
                default:
                    $message = 'unknown error';
                    break;
            }
        }

        if (isset($message)) {
            throw new \RuntimeException('Error encoding/decoding JSON: ' . $message);
        }
    }
212095
def from_errno(cls, errno):
        """"""
        message = '{}: {}'.format(pyuv.errno.errorcode.get(errno, errno),
                                    pyuv.errno.strerror(errno))
        return cls(message, errno)
414461
public function errorHandler($errno, $errstr = '', $errfile = '', $errline = '')
    {
        if (!($errno & error_reporting())) {
            return;
        }
        $this->log->error("Code:{code}\tMsg:{msg}\tFile:{file}\tLine:{line}",
            ['code' => $errno, 'msg' => $errstr, 'file' => $errfile, 'line' => $errline]);
    }
954347
public function onError($errno, $errstr, $errfile, $errline)
    {
        switch($errno)
        {
            case E_ERROR:
            case E_PARSE:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            case E_USER_ERROR:
            case E_RECOVERABLE_ERROR:
                $method = 'error';
                break;
            case E_WARNING:
            case E_CORE_WARNING:
            case E_COMPILE_WARNING:
            case E_USER_WARNING:
                $method = 'warning';
                break;
            case E_NOTICE:
            case E_USER_NOTICE:
                $method = 'notice';
                break;
            case E_STRICT:
            case E_DEPRECATED:
            case E_USER_DEPRECATED:
                $method = 'info';
                break;
        }
        Log::$method($errstr, [
            'trace'     => $this->getTrace(),
            'errorFile' => $errfile,
            'errorLine' => $errline,
        ]);
    }
766318
public static function error_log($errn,$errstr,$file,$line,$context){
		LogMaster::log($errstr." at ".$file." line ".$line);
	}
675688
public function error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
    {
        // throwing an exception in an error handler will halt execution
        //   set the last error and continue
        $this->last_error = compact('errno', 'errstr', 'errfile', 'errline', 'errcontext');
    }
324672
public static function errorHandler($errno, $errstr, $errfile = null, $errline = null, array $errcontext = array())
    {
//echo __METHOD__;
        if (!(error_reporting() & $errno)) {
            return;
        }
        self::exceptionHandler(
            new Error($errstr, Response::STATUS_ERROR, $errfile, $errline)
        );
    }
1355279
protected static function handleError($status)
    {
        $msg = '';

        switch ($status) {
            case JSON_ERROR_DEPTH:
                $msg = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                $msg = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                $msg = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                $msg = 'Syntax error, malformed JSON';
                break;
            case 5: //alias for JSON_ERROR_UTF8 due to Availability PHP 5.3.3
                $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
        }

        if ($msg !== '') {
            throw new \RuntimeException($msg);
        }
    }
513381
private function handleCurlError($errno, $message)
    {
        switch ($errno) {
            case CURLE_COULDNT_CONNECT:
            case CURLE_COULDNT_RESOLVE_HOST:
            case CURLE_OPERATION_TIMEOUTED:
                $msg = "Could not connect";
                break;
            case CURLE_SSL_CACERT:
            case CURLE_SSL_PEER_CERTIFICATE:
                $msg = "Could not verify SSL certificate.";
                break;
            default:
                $msg = "Unexpected curl error.";
        }

        $msg .= "\n\n(Network error [errno $errno]: $message)";
        throw new \LeaseCloud\Error($msg);
    }
180100
public static function throwErrorException($errno, $errstr, $errfile, $errline)
    {
        if (error_reporting() & $errno) { //check if error level is set
            throw new \ErrorException(
                sprintf('%s: %s', self::getErrorTypeString($errno), $errstr),
                0,
                $errno,
                $errfile,
                $errline
            );
        }
    }
143007
private function addError($err, $offset = 0)
    {
        $info = $this->source->getDebugInfo($offset);
        $this->sdopx->rethrow($err, $info['line'], $info['src']);
    }
320715
public static function errorToException($errno, $errstr, $errfile, $errline)
    {
        $exclude = E_STRICT | E_NOTICE | E_USER_NOTICE;
        if (((error_reporting() & $errno) != $errno) || (($exclude & $errno) == $errno)) {
            return false;
        }

        $constants = get_defined_constants(true);
        $name = 'Unknown PHP Error (' . $errno . ')';
        foreach ($constants['Core'] as $c => $value) {
            if ((substr($c, 0, 2) != 'E_') || ($value != $errno)) {
                continue;
            }

            $name = 'PHP ' . ucwords(str_replace('_', ' ', strtolower(substr($c, 2))));
        }

        $exception = new \RuntimeException(sprintf('%s: %s in %s on line %d', $name, $errstr, $errfile, $errline), $errno);

        // Impossible to throw an exception without stack trace
        // happens when errors occour in shutdown scope (i.e. serialize handler)
        if (count($exception->getTrace()) < 1) {
            return false;
        }

        throw $exception;
    }