Get the last error that occurred on the socket

@return string
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';
        }
    }
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);
    }
649651
public function error()
	{
		// We need this because the error info is discarded by the
		// server the first time you request it, and query() already
		// calls error() once for logging purposes when a query fails.
		static $error = array('code' => 0, 'message' => NULL);

		$message = mssql_get_last_message();
		if ( ! empty($message))
		{
			$error['code']    = $this->query('SELECT @@ERROR AS code')->row()->code;
			$error['message'] = $message;
		}

		return $error;
	}
984532
private function getError() {
        if (!curl_errno($this->curl)) return array();
        return array('error_no' => curl_errno($this->curl), 'error' => curl_error($this->curl));
    }
1229519
public function getErrorCodeFromHandle()
    {
        $errorNumber = null;

        if ($this->handle !== null) {
            $errorNumber = curl_errno($this->handle);
        }

        return $errorNumber === 0 ? null : $errorNumber;
    }
1080696
public function getErrorsAsString()
    {
        $string = '';
        foreach ($this->getErrors() as $error) {
            $string .= sprintf(
                "%s: %s",
                $error['field'],
                $error['message']
            );
            if (isset($error['rejected'])) {
                $string .= sprintf(" ('%s' given)", $error['rejected']);
            }
            $string .= ";\n";
        }

        return trim($string);
    }
558054
public function getFirstError()
    {
        if (empty($this->errorMessages)) {
            return '';
        }

        reset($this->errorMessages);
        return current(current($this->errorMessages));
    }
1304625
public function getLastErrorMessages()
    {
        $message = '';

        if ($this->hasError()) {

            foreach ($this->errors as $exception) {
                $message .= $exception->getMessage() . ',' . PHP_EOL;
            }
        }

        return $message;
    }
485061
public function getErrorMessage()
     {
         $messages = $this->getMessage();
         $critical = $this->getCritical();
         $msgError = "";
         $i = 0;
         foreach ($messages as $message ) {

             if ($critical[$i++]) {
                 $msgError .= "{$message}\n";
             }
         }

         return $msgError;
     }
1211656
private function getLastJsonError()
    {
        static $messages = [
            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',
        ];
        $jsonLastError = json_last_error();

        return array_key_exists($jsonLastError, $messages) ? $messages[$jsonLastError] : 'Empty response received';
    }
904557
public function getErrorDescription(): string
    {
        if (isset(self::$errorReasons[$this->statusCode][$this->errorReason])) {
            return self::$errorReasons[$this->statusCode][$this->errorReason];
        }

        return '';
    }
549222
public function errorInfo()
	{
		return array
		(
			0 => $this->driver->getSQLState(),
			1 => $this->driver->getErrorCode(),
			2 => $this->driver->getLastMessage()
		);
	}
526991
public static function lastErrorMsg()
    {
        if (is_string(self::$error)) {
            return self::$error;
        }

        switch (self::$error) {
            case 0:
                $msg = 'No Error';
                break;

            case self::EXISTS:
                $msg = 'The target path "' . self::$target . '" already exists';
                break;

            case self::IS_LINK:
                $msg = 'The target path "' . self::$target . '" is a symbolic link';
                break;

            case self::NOT_FOUND:
                $msg = 'The target path "' . self::$target . '" does not appear to exist';
                break;

            case self::NOT_DIRECTORY:
                $msg = 'The target path "' . self::$target . '" does not appear to be a folder';
                break;

            case self::NOT_GRAV_ROOT:
                $msg = 'The target path "' . self::$target . '" does not appear to be a Grav instance';
                break;

            case self::ZIP_OPEN_ERROR:
                $msg = 'Unable to open the package file';
                break;

            case self::ZIP_EXTRACT_ERROR:
                $msg = 'Unable to extract the package. ';
                if (self::$error_zip) {
                    switch(self::$error_zip) {
                        case \ZipArchive::ER_EXISTS:
                            $msg .= 'File already exists.';
                            break;

                        case \ZipArchive::ER_INCONS:
                            $msg .= 'Zip archive inconsistent.';
                            break;

                        case \ZipArchive::ER_MEMORY:
                            $msg .= 'Memory allocation failure.';
                            break;

                        case \ZipArchive::ER_NOENT:
                            $msg .= 'No such file.';
                            break;

                        case \ZipArchive::ER_NOZIP:
                            $msg .= 'Not a zip archive.';
                            break;

                        case \ZipArchive::ER_OPEN:
                            $msg .= "Can't open file.";
                            break;

                        case \ZipArchive::ER_READ:
                            $msg .= 'Read error.';
                            break;

                        case \ZipArchive::ER_SEEK:
                            $msg .= 'Seek error.';
                            break;
                    }
                }
                break;

            case self::INVALID_SOURCE:
                $msg = 'Invalid source file';
                break;

            default:
                $msg = 'Unknown Error';
                break;
        }

        return $msg;
    }
786851
public function getErrorMessage()
    {
        if (is_string($this->jsonError)) {
            return $this->jsonError;
        } elseif (isset($this->jsonError['message'])) {
            return $this->jsonError['message'];
        }
        return '';
    }
1321391
public function getLastErrorMessage()
    {
        $message = null;
        $error = $this->getConnection()->errorInfo();

        if (is_array($error) && isset($error[2])) {
            $message = $error[2];
        }

        return $message;
    }
376485
public function getErrorMessage() {
        if($this->errorMessage) {
            return $this->errorMessage;
        }

        return sprintf(self::$defaultErrorMessagePattern, $this->getName());
    }
553679
public function getLastError()
    {
        if($this->lastError) {
            return $this->lastError->getMessage();
        }
        $error = $this->pdo->errorInfo();
        if ($error[1]) {
            print_debug($error);
        }
        return $error[2];
    }