Allows other systems such as the form's validator, to set this element as invalid. If no error message is
specified, the default error message will be set.
@param string|null $message
194653
public function setError(?string $message = null) : void
    {
        $this->is_valid = false;
        $this->error = (null === $message) ? $this->default_error : $message;
    }
726326
public function float($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return !(filter_var($val, FILTER_VALIDATE_FLOAT) === FALSE);
                       }, $message);
        return $this;
    }
727027
public void addValidationError(String message) {
        messages.add(new UIMessageDTO(message, null, UIMessage.Severity.ERROR));
        valid = false;
        canExecute = false;
    }
910446
protected void fail(String message) {
        failed = true;
        messageVector.add(new ValidationMessage(lastElementId, message));
    }
484222
public function integer($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return !(filter_var($val, FILTER_VALIDATE_INT) === FALSE);
                       }, $message);
        return $this;
    }
1110808
public function setValidator(string $name, callable $callback, string $message = ''): self
    {
        if ($name = \trim($name)) {
            $this->_validators[$name] = $callback;

            if ($message) {
                $this->setMessage($name, $message);
            }
        }

        return $this;
    }
14227
public function exists( $message = null)
    {
        $this->setRule(__FUNCTION__, function ($val) {
            return null !== $val;
        }, $message);
        return $this;
    }
695204
public static function error($message = null, $name = null)
    {
        return self::generic($message, ErrorMessage::$CSSClass, $name);
    }
1106290
protected function setError($code, $message)
    {
        $this->error = new \OtherCode\Rest\Core\Error($code, $message);
    }
1019702
private function errorResponse($message = null)
    {
        if ($message === null)
            $message = 'Unknown error';

        return App::$View->render('editor/load_error', [
            'callbackId' => (int)App::$Request->query->get('CKEditorFuncNum'),
            'message' => $message
        ],__DIR__);
    }
636846
public function error(string $message)
    {
        $this->relay->send(
            $message,
            Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW | Relay::PAYLOAD_ERROR
        );
    }
1015239
public function setMessage($message)
    {
        $messageVariables = null;

        if (is_array($message)) {
            if (array_key_exists('messageVariables', $message)) {
                $messageVariables = $message['messageVariables'];
            }

            if (array_key_exists('message', $message)) {
                $message = $message['message'];
            } else {
                $messageVariables = $message;
                $message          = $this->messageTemplate;
            }
        }

        if (!is_string($message)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([array|string $message]); %s given.',
                    __METHOD__,
                    is_object($message) ? get_class($message) : gettype($message)
                ),
                E_ERROR
            );
        }

        $this->message = $this->createMessage($message, $messageVariables);

        return $this;
    }
1189578
public function error($message) {
        $message = printPretty($message, $return=true);

        $hStream = CLI ? \STDERR : fopen('php://stderr', 'a');
        fwrite($hStream, $message);
        if (!CLI) fclose($hStream);
    }
575023
public function set_error($message, $halt = false)
    {
        if ($message instanceof Exception) {
            $message = $message->getMessage();
        }

        $this->_errors[] = $message;
        log_message('error', $message);

        if ($halt) {
            show_error($message);
        }
    }
744052
private static function validateError(string $message, bool $throws): bool
    {
        if ($throws) {
            throw new ValidatorException($message);
        }

        return false;
    }
1361674
public function unique($message = null)
    {
        $this->addValidationRule('_unique');

        if (! is_null($message)) {
            $this->addValidationMessage('unique', $message);
        }

        return $this;
    }
488773
public static function invalidArgument($message = null)
    {
        $defaultMessage = sprintf('Invalid argument passed in GameParameters.');
        $message = null === $message ? $defaultMessage : $message;

        return new static($message);
    }