Adds a failure message.

@param string $messageKey The message key.

@return void

@throws \RuntimeException If the message key is unknown.
559430
final protected function addFailureMessage(string $messageKey) : void
    {
        $messages = $this->getPossibleMessages();

        if (! isset($messages[$messageKey])) {
            throw new \RuntimeException('Unknown message key: ' . $messageKey);
        }

        $this->failureMessages[$messageKey] = $messages[$messageKey];
    }
1157625
protected final void addError(String msgKey, Object... args) {
    getFlash().addErrorNow(getTextInternal(msgKey, args));
  }
571358
protected final void addFlashMessage(String msgKey, Object... args) {
    getFlash().addMessage(getTextInternal(msgKey, args));
  }
1374252
public function remove($key)
    {
        $this->load();

        if ($this->exists($key)) {
            unset($this->config[$key]);
            return true;
        } else {
            throw new RuntimeException(sprintf('Attempted to read non-existing key "%s"', $key));
        }
    }
1129237
public void addValidator(Validator validator, String errorKey) {
        if(!errors.containsKey(errorKey))
            errors.addValidator(errorKey, validator);
    }
151429
protected function handleError($response) {
    $errorMsg = $response->getValue('errorMsg');
    self::$logger->error("Error in remote call to ".$this->serverUrl.": ".$errorMsg."\n".$response->toString(), __FILE__);
    throw new \RuntimeException("Error in remote call to ".$this->serverUrl.": ".$errorMsg);
  }
1334539
private static function addError($message): void
    {
        if (self::$result === false) {
            self::$result = array();
        }
        self::$result[] = $message;
    }
119002
protected function assignFlash($key, $viewKey)
    {
        if (count($msg = $this->getFlash($key)) > 0) {
            $this->set($viewKey, implode(", ", $msg));
        }
    }
1136063
protected function throwException($code, $msg)
    {
        $args = func_get_args();

        $code = array_shift($args);

        throw new \RuntimeException(call_user_func_array('sprintf', $args), $code);
    }
412295
private function error(): void
    {
        $code = socket_last_error($this->socket);
        $msg  = socket_strerror($code);
        throw new \RuntimeException($msg, $code);

    }
101834
protected function compileMin($key, $masque)
    {
        if (!preg_match("/^min:(\d+)$/", $masque, $match)) {
            return;
        }

        $length = (int) end($match);

        if (Str::len($this->inputs[$key]) > $length) {
            return;
        }

        $this->fails = true;
        
        $this->last_message = $this->lexique('min', [
            'attribute' => $key,
            'length' => $length
        ]);

        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
223027
private function validate($key, $data)
    {
        // validates key
        if (in_array($key, $this->unauthorizedKeys)) {
            throw new \RuntimeException(
                'Injected key `'.$key.'` is not authorized. (Unauthorized keys: '.implode(', ', $this->unauthorizedKeys).')'
            );
        }

        if (in_array($key, array_keys($this->injectedData))) {
            throw new \RuntimeException(
                'Injected key `'.$key.'` is already used.'
            );
        }

        // validates data (must be serializable)
        if (false !== $data && false === json_encode($data)) {
            throw new \RuntimeException(
                'Injected data is not serializable.'
            );
        }
    }
1251541
public function push(string $errorMessage, ?string $key = null): self
    {
        if ($key === null) {
            $this->errors[] = $errorMessage;
        } else {
            $this->errors[$key][] = $errorMessage;
        }

        return $this;
    }
1123592
public function addVariable($key, $value)
    {
        if (is_null($key) || ! is_string($key)) {
            throw new RuntimeException(sprintf('The key where to save your variable in the expression context is invalid. Got "%s".', $key));
        }

        $this->variables[$key] = $value;
    }
1007891
protected function compileRequired($key, $masque)
    {
        if (!isset($this->inputs[$key])
            || is_null($this->inputs[$key])
            || $this->inputs[$key] === ''
        ) {
            $this->last_message = $message = $this->lexique('required', $key);
            
            $this->errors[$key][] = [
                "masque" => $masque,
                "message" => $message
            ];
            
            $this->fails = true;
        }
    }
1080892
private function write($key, array $data)
    {
        $fname = $this->getObjectPath($key);
        $content = serialize($data);
        $path = dirname($fname);
        if (!file_exists($path) && !mkdir($path, 0755, true)) {
            throw new \RuntimeException('Unable to create directory for cache');
        }
        file_put_contents($fname, $content);
    }
351648
public static void error(TraceComponent tc, String msgKey) {
    if(isTracing()) SibTr.error(tc, msgKey);

  }