Adds an error object for.

@param AnError|array|string $error Error object

@return AnDomainBehaviorValidatable
189271
public function addError($error)
    {
        if (is_string($error)) {
            $error = array('message' => $error);
        }

        if (is_array($error)) {
            $error = new AnError($error);
        }

        if (!isset($this->_errors[$this->_mixer])) {
            $this->_errors[$this->_mixer] = new AnObjectSet();
        }

        $this->_errors[$this->_mixer]->insert($error);

        return $this;
    }
228683
public function addError(ErrorStore $error)
    {
        $this->outputMode = self::MODE_ERROR;
        $this->errors[] = $error;
    }
1162863
public function exist($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::EXIST, 'message' => $error]);
        }

        return $this;
    }
461467
public function addError(string $error, array $options = []) {
        $this->validation->addError($this->getName(), $error, $options);
        return $this;
    }
1204542
public function addErrors(array $errors = [])
    {
        foreach ($errors as $attribute => $error) {
            if (is_array($error)) {
                foreach ($error as $e) {
                    $this->addError($attribute, $e);
                }
            } else {
                $this->addError($attribute, $error);
            }
        }
    }
187906
public function setError($error) 
    {
        if (!$this->_isNumericArray($error)) {
            $error =  array ($error);    
        }
        $this->_fields['Error']['FieldValue'] = $error;
        return $this;
    }
240190
public function withError(string $error): PayloadInterface
    {
        if ($this->error === $error) {
            return $this;
        }

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

        return $clone;
    }
1156408
public function addError($errorCode)
    {
        $this->errors[] = $errorCode;
        if (!array_key_exists('Errors', $this->attributes)) {
            $this->attributes['Errors'] = '';
        }

        return $this;
    }
1075633
protected function error ($error)
	{
		if (!$this->__errors) { $this->__construct_errors(); }

		$this->__errors->push($error);
	}
123987
public function addErrors(array $errors)
    {
        foreach ($errors as $error) {
            if (!$error instanceof ValidationError)
                throw new Exception('Error was not instance of ValidationError: '.$error);
            if (!in_array($error, $this->errors))
                $this->errors[] = $error;
        }

        return $this;
    }
8608
public function decorateException($error)
    {
        $application = $this->application;

        if (is_callable($error)) {
            $error = $application->getContainer()->call($error, [$application]);
        }

        if (is_object($error) && !($error instanceof \Exception)) {
            $error = method_exists($error,
                '__toString') ? $error->__toString() : 'Error with object ' . get_class($error);
        }

        if (is_resource($error)) {
            $error = 'Error with resource type ' . get_resource_type($error);
        }

        if (is_array($error)) {
            $error = implode("\n", $error);
        }

        if (!($error instanceof \Exception)) {
            $error = new \Exception(is_scalar($error) ? $error : 'Error with ' . gettype($error));
        }

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

        return $this;
    }
1047729
private function setError($error)
    {
        if (strpos($error, 'ERROR') !== false) {
            if (array_key_exists($error, $this->errors)) {
                throw new Exception($this->errors[$error]);
            } else {
                throw new Exception($error);
            }
        }
    }
703071
public function addError(...$args) {
        $args = func_get_args();
        if(func_num_args()>2){
            foreach ($args as $error) {
                array_push($this->errors, $error);
            }
        } else {
            if(func_get_args()==1) {
                $this->errors[] = $args[0];
            } else {
                $this->errors[$args[0]] = $args[1];
            }
        }
    }
832033
public function withError($message)
    {
        if (is_array($message)) {
            $this->errorBag->setErrors($message);
        } else {
            $this->errorBag->add($message);
        }

        return $this;
    }
505595
protected function addViolation($error, Constraint $constraint)
    {
        $this->context->buildViolation($constraint->message)
            ->setParameter('%error%', $error)
            ->addViolation()
        ;

        return true;
    }
191046
public function addTypeError($value, $type = '') {
        $type = $type ?: $this->getType();

        $this->validation->addError(
            $this->getName(),
            'type',
            [
                'type' => $type,
                'value' => is_scalar($value) ? $value : null,
                'messageCode' => is_scalar($value) ? "{value} is not a valid $type." : "The value is not a valid $type."
            ]
        );

        return $this;
    }