lastJsonErrorMessage

@return string
339718
protected function lastJsonErrorMessage($error)
    {
        $errors = [
            JSON_ERROR_DEPTH          => 'Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
            JSON_ERROR_CTRL_CHAR      => 'Control character error, possibly incorrectly encoded',
            JSON_ERROR_SYNTAX         => 'Syntax error',
            JSON_ERROR_UTF8           => 'Malformed UTF-8 characters, possibly incorrectly encoded',
        ];

        return isset($errors[$error]) ? $errors[$error] : 'Unknown error';
    }
1100573
public function getLastError() {

		if(true === $this -> connection instanceof \mysqli) {
			$this -> connect();
		}

		return $this -> connection -> error;
	}
883309
final public static function fromLastError()
    {
        $error = error_get_last();
        if ($error !== null) {
            return new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
        }
    }
1102889
public function seeResponseIsJson()
    {
        $responseContent = $this->connectionModule->_getResponseContent();
        \PHPUnit\Framework\Assert::assertNotEquals('', $responseContent, 'response is empty');
        json_decode($responseContent);
        $errorCode = json_last_error();
        $errorMessage = json_last_error_msg();
        \PHPUnit\Framework\Assert::assertEquals(
            JSON_ERROR_NONE,
            $errorCode,
            sprintf(
                "Invalid json: %s. System message: %s.",
                $responseContent,
                $errorMessage
            )
        );
    }
181075
public function getLastErrorResponse() {
        if (!empty($this->rawResponses)) {
            foreach (array_reverse($this->rawResponses) as $x) {
                if (isset($x['error'])) {
                    return $x;
                }
            }
        }
    }
886309
public function getErrorsAsText(): string
    {
        $result = '';
        $fieldCounter = 0;
        $fields = $this->getErrors();

        foreach ($fields as $fieldName => $fieldErrors) {
            $fieldCounter++;
            $result .= "$fieldCounter) $fieldName\n";

            foreach ($fieldErrors as $error) {
                $result .= "   - $error\n";
            }
        }

        return $result;
    }
703859
public function last(): string
    {
        $this->rewind();
        $previousElement = $this->getCurrentElement();
        while ($this->valid()) {
            $previousElement = $this->getCurrentElement();
            $this->next();
        }
        return $previousElement->getValue();
    }
321314
public function getLastError(): string
    {
        if ($this->isConnected() && $this->socket) {
            $err = @socket_last_error($this->socket);
            if ($err) {
                $err = socket_strerror($err);
            }
            if (!$err) {
                $err = 'Unknown error';
            }
            return $err;
        } else {
            return 'Not connected';
        }
    }
694429
public function getErrorMessage()
    {
        $app = Application::getFacadeApplication();
        $request = $app->make(Request::class);
        $ajax = $app->make(Ajax::class);
        if ($ajax->isAjaxRequest($request)) {
            return t("Invalid token. Please reload the page and retry.");
        } else {
            return t("Invalid form token. Please reload this form and submit again.");
        }
    }
112840
public function getLastMessage() {
        $messagesClone = $this->messages;
        $keys = array_keys($messagesClone);
        $key = array_pop($keys);
        return $this->messages[$key];
    }
885318
public function getLastRuntimeMessage()
    {
        end($this->runtime_messages);
        $value = current($this->runtime_messages);
        reset($this->runtime_messages);

        return $value;
    }
1311952
private static function getLastJsonError()
    {
        if (function_exists('json_last_error_msg')) {
            return json_last_error_msg();
        }
        static $errors = array(
            JSON_ERROR_NONE           => null,
            JSON_ERROR_DEPTH          => 'Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
            JSON_ERROR_CTRL_CHAR      => 'Unexpected control character found',
            JSON_ERROR_SYNTAX         => 'Syntax error, malformed JSON',
            JSON_ERROR_UTF8           => 'Malformed UTF-8 characters, possibly incorrectly encoded',
        );
        $error = json_last_error();

        return array_key_exists($error, $errors)
            ? $errors[$error]
            : sprintf('Unknown error (%s)', $error);
    }
538460
public function lastError()
	{

		//put this in try...catch block for better error handling
		try{

			//check if there is a valid service instance
			if ( ! $this->validService() ) 
			{
				//throw error
				throw new MySQLException("Not connected to a valid database service");

			}

			//get the error message and return
			return $this->service->error;

		}

		//diplay error message
		catch(MySQLException $MySQLExceptionObject){

			//display error message
			$MySQLExceptionObject->errorShow();

		}

	}
756738
public function getErrorString()
    {
        $this->execute();
        
        return $this->error ? $this->error['errcode'] . ':' . $this->error['errmsg'] : null;
    }
1055278
function ErrorMsg()
	{
		if (!function_exists('adodb_throw')) {
			if ($this->_dbat < 0) {
				$db = false;
			}
			else {
				$db = $this->DB();
			}

			// last error could be database error too
			if ($db && $db->ErrorMsg()) {
				return $db->ErrorMsg();
			}
		}
		return $this->_lasterr;
	}
201855
function captureLastError()
    {
        if (null === $error = error_get_last()) {
            return;
        }

        $e = new \ErrorException(
            @$error['message'], 0, @$error['type'],
            @$error['file'], @$error['line']
        );

        return $this->captureException($e);
    }
714938
protected function checkJsonError()
    {
        if(!function_exists('json_last_error'))
        {
            throw new BadFunctionCallException('json_last_error() function not exits');
        }
        
        $jsonError = json_last_error();
        if($jsonError !== JSON_ERROR_NONE)
        {
            $this->jsonErrorException($jsonError);
        }
        
        return true;
    }