add an error message to the list

@param mixed $error
@return Result $this
501305
public function addError($error)
    {
        if (is_array($error)) {
            $this->errors += $error;
        } else {
            $this->errors[] = $error;
        }

        return $this;
    }
653326
public function addError(ErrorInterface $error)
    {
        // create a local copy of the error stack
        $errors = $this->errors;

        // append the error to the stack
        $errors[] = $error;

        // copy the error stack back to the thread context
        $this->errors = $errors;
    }
1279693
protected function addError(\Exception $exception)
    {
        $this->errorList[$exception->getCode()] = [
            'message'   => $exception->getMessage(),
            'line'      => $exception->getLine(),
            'file'      => $exception->getFile(),
            'trace'     => $exception->getTraceAsString(),
        ];
        $this->hasErrors = true;

        return $this;
    }
1197939
public function regex($regex, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::REGEX, 'value' => $regex, 'message' => $error]);
        }

        return $this;
    }
432856
public function countIn($countIn, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::COUNTIN, 'value' => $countIn, 'message' => $error]);
        }

        return $this;
    }
518656
public function addError(Exception $error)
    {
        $errorNode = $this->addElement("error", $error->getMessage());

        if (!$error instanceof NoRecordsMatchException) {
            $this->status = '400';
        }

        if ($error->getErrorName()) {
            $errorNode->setAttribute("code", $error->getErrorName());
        } else {
            $errorNode->setAttribute("code", "badArgument");
        }
    }
671404
public function setError($error)
    {
        $this->ocorrenciaTipo = self::OCORRENCIA_ERRO;
        $this->error          = $error;

        return $this;
    }
240190
public function withError(string $error): PayloadInterface
    {
        if ($this->error === $error) {
            return $this;
        }

        $clone = clone $this;
        $clone->error = $error;

        return $clone;
    }
627006
public function lessThan($lessThan, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::LESSTHAN, 'value' => $lessThan, 'message' => $error]);
        }

        return $this;
    }
413929
public function moreThan($moreThan, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::MORETHAN, 'value' => $moreThan, 'message' => $error]);
        }

        return $this;
    }
1008051
public function ip($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::IP, 'message' => $error]);
        }

        return $this;
    }
216259
public function addCustomErrors($errors)
    {
        if ($errors) {
            foreach ($errors as $error) {
                if (!is_a($error, 'AV\Form\FormError')) {
                    throw new InvalidArgumentException('Custom errors must be AV\Form\FormError objects');
                }
                else {
                    $this->errors[] = $error;
                }
            }
        }

        // Call isValid to update valid status in restore data handlers
        $this->isValid();
    }
1198996
public function setError($error, $code = \wf\model\Error::DEFAULT_MODEL_ERROR_CODE)
    {
        if ($error instanceof \wf\model\Error) {
            $this->error = $error;
        } elseif (is_scalar($error)) {
            $this->error = new \wf\model\Error($error, $code);
        } else {
            throw new \InvalidArgumentException('错误的消息类型');
        }

        return $this;
    }
197053
private function addError($errorCode, $valid = true)
    {
        $this->isValid = $valid;
        $this->errors[] = $errorCode;

        return $this;
    }
985183
public function setError($error, $propertyName)
    {
        $this->errors[$this->propertyName][$propertyName] = $error;

        return $this;
    }
839935
public function addError($errorMessage)
    {
        if (is_array($errorMessage)) {
            if (count($errorMessage)) {
                foreach ($errorMessage as $message) {
                    $this->errors[] = $message;
                }
            }
        } else {
            $this->errors[] = $errorMessage;
        }
    }
1001101
public function alphaNum($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::ALPHANUM, 'message' => $error]);
        }

        return $this;
    }