Add an error message into the $errors.

@param string $key
@param array  $_errors
9495
public function add_error( $key, $_errors ) {
		if ( ! $_errors || ! $this->errors instanceof WP_Error ) {
			return;
		}

		if ( ! $this->fields->has( $key ) ) {
			return;
		}

		foreach ( is_array( $_errors ) ? $_errors : [ $_errors ] as $message ) {
			$this->errors->add( $key, $message );
		}
	}
454095
public function errors(array $errors, $code = 0)
    {
        foreach ($errors as $error) {
            $this->error($error, $code);
        }
    }
519799
public static function setError($id, $errors, $element = "")
    {
        if (!is_array($errors)) {
            $errors = array($errors);
        }

        if (empty($_SESSION["form"][$id]["errors"][$element])) {
            $_SESSION["form"][$id]["errors"][$element] = array();
        }

        foreach ($errors as $error) {
            $_SESSION["form"][$id]["errors"][$element][] = $error;
        }
    }
265600
private function addErrors($field, $errors)
	{
		$this->errors->$field = array_merge((array)$this->errors->$field, $errors);
	}
639065
public function setError($error, $key = null)
	{
		if ($error instanceof Exception)
		{
			$this->error = $error;
			return true;
		}

		return false;
	}
79718
private function _addError($attr, $msg)
    {
        if (!array_key_exists($attr, $this->errors)) {
            $this->errors[$attr] = array();
        }
        array_push($this->errors[$attr], $msg);
    }
1272811
public void error(Error errorKey) {
        report(diags.error(null, source, null, errorKey));
    }
1204258
public function addError(string $key, string $message, string $group = null): self
    {
        if (!empty($group)) {
            $this->errors[$group][$key][] = $message;
        } else {
            $this->errors[$key][] = $message;
        }

        return $this;
    }
905642
public static function set($error, $key = null)
    {
        if ($key) {
            static::$error[$key][] = $error;
        } else {
            static::$error[] = $error;
        }
    }
486571
protected function listValidationErrors(array $errors, OutputInterface $output)
    {
        if (count($errors) === 1) {
            $this->stdErr->writeln('The following error was found:');
        } else {
            $this->stdErr->writeln(sprintf(
                'The following %d errors were found:',
                count($errors)
            ));
        }

        foreach ($errors as $key => $error) {
            if (is_string($key) && strlen($key)) {
                $output->writeln("$key: $error");
            } else {
                $output->writeln($error);
            }
        }
    }
101045
public void error(String key, Object ... args) {
        report(diags.error(source, null, key, args));
    }
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 );
	}
258580
public function addMessage($key, array $args = array())
    {
        // We will only display these messages once.
        if (isset($this->keys[$key]) === false) {
            // Add it to the keys, so the CMS can display it.
            $this->keys[$key] = array('key' => $key, 'params' => $args);
            $this->messages[] = $this->getHelp($key, $args);
        }
    }
871922
public function setError($key, $value)
    {
        if (isset($key)) {
            gplcart_array_set($this->errors, $key, $value);
        } else {
            $this->errors = (array) $value;
        }

        return $this->errors;
    }
512790
public function setErrors($errors)
    {
        $this->errors = strtolower((string) $errors);

        $message = sprintf("Set errors flag to [%s].", $this->errors);
        $this->log($message, Project::MSG_DEBUG);
    }
839935
public function addError($errorMessage)
    {
        if (is_array($errorMessage)) {
            if (count($errorMessage)) {
                foreach ($errorMessage as $message) {
                    $this->errors[] = $message;
                }
            }
        } else {
            $this->errors[] = $errorMessage;
        }
    }
1222126
public function add_error( $key, $message )
	{
		$this->success = false;
		$this->errors[$key][] = $message;
	}