Get the error message for an error row.

@param array $error The error row.
@return string Returns a formatted/translated error message.
551900
private function formatErrorMessage(array $error) {
        if (isset($error['messageCode'])) {
            $messageCode = $error['messageCode'];
        } elseif (isset($error['message'])) {
            return $error['message'];
        } else {
            $messageCode = $error['error'];
        }

        // Massage the field name for better formatting.
        $msg = $this->formatMessage($messageCode, $error);
        return $msg;
    }
392670
private static function readError($error)
    {
        $err = new stdClass();
        $err->message = key($error);
        $err->status = true;

        return $err;
    }
180355
public function response(array $errors)
    {
        $messages = implode(' ', array_flatten($errors));

        return Response::json(ResponseUtil::makeError($messages), 400);
    }
460423
public function log($error)
    {
        if ($error instanceof \Error || $error instanceof \ErrorException) {
            return $this->logError($error);
        }
        
        if ($error instanceof \Exception) {
            return $this->logException($error);
        }
        
        $message = "Unable to log a " . (is_object($error) ? get_class($error) . ' ' : '') . gettype($error);
        $this->getLogger()->log(LogLevel::WARNING, $message);
    }
341727
protected static function getErrorMessage($code)
    {
        $string = socket_strerror($code);

        // search constant starting with SOCKET_ for this error code
        foreach (get_defined_constants() as $key => $value) {
            if($value === $code && strpos($key, 'SOCKET_') === 0) {
                $string .= ' (' . $key . ')';
                break;
            }
        }

        return $string;
    }
593435
protected function formatErrors(string $errors)
    {
        $errors = json_decode($errors);
        $output = '';

        foreach ($errors as $error)
            foreach ($error as $message)
                $output .= $message . "\r\n";

        return $output;
    }
444569
public function get_error_messages(
		/** @noinspection PhpUnusedParameterInspection */
		$key, $errors
	) {
		$columns = $this->app->db->get_columns( $this->get_related_table_name() );
		unset( $columns['id'] );
		$columns = $this->app->utility->array_combine( $columns, 'name' );

		return array_map( function ( $d ) use ( $key, $columns ) {
			$key = $this->table_column_to_name( $key, $columns );

			return "$d: [{$key}]";
		}, $errors );
	}
179781
private function getErrorMessage(array $result)
    {
        $errorMessage = '';
        if (isset($result['errors'][0]['property']) && isset($result['errors'][0]['message'])) {
            $errorMessage = $result['errors'][0]['property'] . ': ' . $result['errors'][0]['message'];
        }
        return $errorMessage;
    }
706609
public function getErrorMessage()
    {
        if (array_key_exists($this->error, $this->errorMessages)) {

            return $this->errorMessages[$this->error];
        }

        return 'Unknow error';
    }
81697
public function getErrorMessage($error, $default = NULL)
    {
        $messages = $this->_http_files->getErrorMessages();
        if (isset($messages[$error])) {
            return $messages[$error];
        } else {
            if (is_null($default)) {
                return "Erreur indéfinie !";
            } else {
                return $default;
            }
        }
    }
698636
public function response(array $errors)
    {
        return $this->ajaxRequest
            ? $this->formatJsonErrorsResponse($errors)
            : parent::response($errors);
    }
1346733
protected function getErrorMessage($errorCode)
    {
        if (!isset($this->errorMessageMatrix[$errorCode])) {
            $this->errorMessageMatrix[$errorCode] = 'ERROR_MSG_UNKNOWN';
        }

        // if additional information exist -> add it here
        if ($this->info) {
            if (is_string($this->info)) {
                $this->errorMessageMatrix[$errorCode] .= ' '.$this->info;
            } elseif (count($this->info) != 1 || $this->info[0] != null) {
                foreach ($this->info as $info) {
                    $info = serialize($info);
                    $this->errorMessageMatrix[$errorCode] .= ' '.$info;
                }
            }
        }

        // Return constructed error message
        return $this->errorMessageMatrix[$errorCode];
    }
562635
public static function getErrorMessage($error)
    {
        switch ($error) {
            case JSON_ERROR_NONE:
                return 'JSON_ERROR_NONE';
            case JSON_ERROR_DEPTH:
                return 'JSON_ERROR_DEPTH';
            case JSON_ERROR_STATE_MISMATCH:
                return 'JSON_ERROR_STATE_MISMATCH';
            case JSON_ERROR_CTRL_CHAR:
                return 'JSON_ERROR_CTRL_CHAR';
            case JSON_ERROR_SYNTAX:
                return 'JSON_ERROR_SYNTAX';
            case JSON_ERROR_UTF8:
                return 'JSON_ERROR_UTF8';
        }

        if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
            switch ($error) {
                case JSON_ERROR_RECURSION:
                    return 'JSON_ERROR_RECURSION';
                case JSON_ERROR_INF_OR_NAN:
                    return 'JSON_ERROR_INF_OR_NAN';
                case JSON_ERROR_UNSUPPORTED_TYPE:
                    return 'JSON_ERROR_UNSUPPORTED_TYPE';
            }
        }

        return 'JSON_ERROR_UNKNOWN';
    }
1361718
public function getError($error, $opts=array()) {
		if (is_array($error) && isset($error['filter'])) {
			return $this->getErrorMessage($error['filter'], $error+$opts);
		} elseif (is_int($error)) {
			return $this->getErrorMessage($error, $opts);
		} else {
			return $this->getErrorMessage(0, $opts);
		}
	}
391337
public function getErrorMessage(int $error): string
    {
        switch ($error) {
            case CURLE_UNSUPPORTED_PROTOCOL:
                return 'Unsupported protocol';
            case CURLE_FAILED_INIT:
                return 'Internal cUrl error?';
            case CURLE_URL_MALFORMAT:
                return 'Malformed URL';
            case CURLE_COULDNT_RESOLVE_PROXY:
                return "Couldn't resolve proxy";
            case CURLE_COULDNT_RESOLVE_HOST:
                return "Couldn't resolve host";
            case CURLE_COULDNT_CONNECT:
                return "Couldn't connect to host, Elasticsearch down?";
            case CURLE_OPERATION_TIMEOUTED:
                return 'Operation timed out';
        }

        return 'Unknown error:'.$error;
    }
1288738
public static function getString($error)
    {
        if (!is_int($error)) {
            throw new \BadMethodCallException("Invalid type, expected integer, got {$error}.");
        }

        switch ($error) {
            case PREG_NO_ERROR: return 'PREG_NO_ERROR';
            case PREG_INTERNAL_ERROR: return 'PREG_INTERNAL_ERROR';
            case PREG_BACKTRACK_LIMIT_ERROR: return 'PREG_BACKTRACK_LIMIT_ERROR';
            case PREG_BAD_UTF8_ERROR: return 'PREG_BAD_UTF8_ERROR';
            case PREG_RECURSION_LIMIT_ERROR: return 'PREG_RECURSION_LIMIT_ERROR';
            case PREG_BAD_UTF8_OFFSET_ERROR: return 'PREG_BAD_UTF8_OFFSET_ERROR';
            default:
                throw new \BadMethodCallException("Tried to convert unknown PREG error {$error} to string");
        }
    }
823096
public static function getMessageFor($code)
    {
        if (isset(self::$errorMessages[$code])) {
            $message = self::$errorMessages[$code];
        } else {
            $message = 'Unknown error code: "' . $code . '"';
        }

        return $message;
    }