@param ContextInterface $context
@param mixed            $errorValue
@param int              $errorCode
@param string           $messageTemplate
@param array            $messageParams

@return array

@SuppressWarnings(PHPMD.StaticAccess)
170502
protected static function createErrorReply(
        ContextInterface $context,
        $errorValue,
        int $errorCode,
        string $messageTemplate,
        array $messageParams
    ): array {
        return BlockReplies::createErrorReply($context, $errorValue, $errorCode, $messageTemplate, $messageParams);
    }
619708
public function validateUnique(array $values, $errorMessage, $errorField = null)
    {
        if (count($values) != count(array_unique($values))) {
            $this->error($errorMessage);
            $this->_errorFields[] = $errorField;
        }
    }
674540
public function setError($errorCode = null, $message = null):ErrorResponseBuilder
    {
        $this->errorCode = $errorCode;

        if (is_array($message)) {
            $this->parameters = $message;
        } else {
            $this->message = $message;
        }

        return $this;
    }
403185
public static function createStartErrorReply(
        ContextInterface $context,
        int $errorCode,
        string $messageTemplate,
        array $messageParams
    ): array {
        $value = null;

        return [
            static::createErrorInfoEntry(
                $context->getCurrentBlockId(),
                $value,
                $errorCode,
                $messageTemplate,
                $messageParams
            ),
        ];
    }
1347159
protected function _respondToError($errorMessage, $httpCode) {
        $this->_setHttpStatusCode($httpCode);
        $this->view->result = array(
            'success' => false,
            'errorMessage' => $errorMessage
        );
    }
47520
protected function jsonDecode($value, $errorMessage = null) {
        $decoded = json_decode($value, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidArgumentException(
                $errorMessage ?: 'The supplied parameter is not a valid JSON object.'
            );
        }

        return $decoded;
    }
613798
public function setValidationError(CoverFishResult $coverFishResult, $errorCode, $errorMessage = null)
    {
        // skip validation if incoming mapping result is already invalid!
        if (false === $coverFishResult->isPass()) {
            return $coverFishResult;
        }

        $coverFishResult->setPass(false);
        $coverFishResult->addError(new CoverFishMessageError($errorCode, $errorMessage));

        return $coverFishResult;
    }
170054
public static function execute($value, ContextInterface $context): array
    {
        $properties      = $context->getProperties();
        $filterId        = $properties->getProperty(static::PROPERTY_FILTER_ID);
        $filterOptions   = $properties->getProperty(static::PROPERTY_FILTER_OPTIONS);
        $errorCode       = $properties->getProperty(static::PROPERTY_FILTER_ERROR_CODE);
        $messageTemplate = $properties->getProperty(static::PROPERTY_MESSAGE_TEMPLATE);

        $output = filter_var($value, $filterId, $filterOptions);

        return $output !== false ?
            static::createSuccessReply($output) :
            static::createErrorReply($context, $value, $errorCode, $messageTemplate, [$filterId, $filterOptions]);
    }
197053
private function addError($errorCode, $valid = true)
    {
        $this->isValid = $valid;
        $this->errors[] = $errorCode;

        return $this;
    }
1340697
protected function handleError( $errorCode, $errorMessage, $query )
	{
		if( $this->errorLevel )
		{
			$log = new \FS_File_Log_Writer( $this->logFile );
			$log->note( "[".$errorCode.": ".$errorMessage." in EXECUTE (\"".$query."\")]" );
			if( $this->errorLevel == 2 )
				trigger_error( $errorCode.": ".$errorMessage." in EXECUTE (\"".$query."\")", E_USER_WARNING );
			else if( $this->errorLevel == 3 )
				trigger_error( $errorCode.": ".$errorMessage." in EXECUTE (\"".$query."\")", E_USER_ERROR );
			else if( $this->errorLevel == 4 )
				throw new \Exception( $errorCode.": ".$errorMessage." in EXECUTE (\"".$query."\")" );
		}
	}
1183417
protected static function filter(
        int $filterId,
        $options = null,
        int $errorCode = ErrorCodes::INVALID_VALUE,
        string $messageTemplate = Messages::INVALID_VALUE,
        RuleInterface $next = null
    ): RuleInterface {
        $filterRule = new Filter($filterId, $options, $errorCode, $messageTemplate);

        return $next === null ? $filterRule : new AndOperator($filterRule, $next);
    }
1253343
private static function buildErrorMessages($errorMessageFile)
    {
        $filePath = $errorMessageFile;

        if ('' == $filePath) {
            $filePath = \realpath(\dirname(__FILE__))
                .DIRECTORY_SEPARATOR.self::$errorDir
                .DIRECTORY_SEPARATOR.self::$language.".php";
        }

        if (false === \file_exists($filePath)) {
            throw new \InvalidArgumentException("Language not found.");
        }

        self::$errorMessages = include $filePath;
        self::$errorMessageFile = $filePath;
    }
1147074
protected function ensureIsUrl($fieldName, $valueToTest, $exceptionCode = 0)
    {
        $regex = '@^(https?|ftp)://[^\s/$.?#].[^\s]*$@iS';

        if (preg_match($regex, $valueToTest) !== 1) {
            $message = sprintf('%s is not a matching url, got "%s"', $fieldName, $valueToTest);
            throw new InvalidValueException($message, $exceptionCode);
        }
    }
349035
public function createErrorView($errorMessage, $exception, $displayExceptions = false, $displayNavMenu = false )
    {
      $viewModel = new ViewModel(array(
          'navMenu' => $displayNavMenu,
          'display_exceptions' => $displayExceptions,
          'errorMessage' => $errorMessage,
          'exception' => $exception,
      ));
      $viewModel->setTemplate('csn-user/error/error');
      return $viewModel;
    }
758290
protected function FillInstance($errorId, $errorMessage, $exception) {
        $this->errorId = $errorId;
        $this->errorMessage = $errorMessage;
        $this->exceptionObj = $exception;
    }
92718
final public static function setError (string $errorMessage=NULL) : bool
	{
		static::$error = "";
		if (!static::hasValue($errorMessage)) return FALSE;
		static::$error = "Check the following field(s) ".stripComma($errorMessage)." and try again.";
		return TRUE;
	}
12997
private static function publishThrowable(string $eventClass, string $errorMessage, KernelContext $context): \Generator
    {
        /**
         * @noinspection VariableFunctionsUsageInspection
         *
         * @var \ServiceBus\Services\Contracts\ExecutionFailedEvent $event
         */
        $event = \forward_static_call_array([$eventClass, 'create'], [$context->traceId(), $errorMessage]);

        yield $context->delivery($event);
    }