Set error message for given field from message manager.

@param string $sFieldName
@param string $sCustomMSGConsumer

@return string
161415
protected function GetMessageForField($sFieldName, $sCustomMSGConsumer)
    {
        $sMessage = '';
        $oMsgManager = TCMSMessageManager::GetInstance();
        if ($oMsgManager->ConsumerHasMessages($sCustomMSGConsumer.'-'.$sFieldName)) {
            $sMessage = $oMsgManager->RenderMessages($sCustomMSGConsumer.'-'.$sFieldName);
        }

        return $sMessage;
    }
652776
protected static function buildErrorMessage(
        array $params,
        string $key,
        $message = null,
        $context = null
    ): string {
        if (empty($message)) {
            $message = 'There was an error with a key: (' . $key . ')'
                . ' in params: (' . json_encode($params, 0, 3) . ')';
        }

        $contextType = gettype($context);

        if (is_object($context)) {
            $context = get_class($context);
        }

        if ($context === null) {
            return $message;
        }

        // Clear json_last_error()
        json_encode(null);

        $json = json_encode($context, JSON_PRETTY_PRINT, self::$depth);

        if (JSON_ERROR_NONE !== json_last_error()) {
            return $message;
        }

        return $message . " - Context ({$contextType}): \n" . $json;
    }
999576
protected function _error($messageKey, $value = null)
    {
        if ($messageKey === null) {
            $keys       = array_keys($this->_messageTemplates);
            $messageKey = current($keys);
        }
        if ($value === null) {
            $value = $this->_value;
        }
        $this->_messages[$messageKey] = $this->_createMessage($messageKey, $value);
    }
326013
def error_messages(yard_coverage, error_text)
      first_message = "You have a #{yard_coverage}% yard documentation coverage. "\
                      "#{config['min_coverage_percentage']}% is the minimum required."

      # Add the undocumented objects text as error messages
      messages = [Overcommit::Hook::Message.new(:error, nil, nil, first_message)]

      errors = error_text.strip.split("\n")
      errors.each do |undocumented_object|
        undocumented_object_message, file_info = undocumented_object.split(/:?\s+/)
        file_info_match = file_info.match(/^\(([^:]+):(\d+)\)/)

        # In case any compacted error does not follow the format, ignore it
        if file_info_match
          file = file_info_match.captures[0]
          line = file_info_match.captures[1]
          messages << Overcommit::Hook::Message.new(
            :error, file, line, "#{file}:#{line}: #{undocumented_object_message}"
          )
        end
      end
      messages
    end
1373369
public function getSchemaErrorMessage()
    {
        $message = NULL;

        foreach ($this->lastSchemaErrors as $error) {
            $message .= sprintf(
                "[%s] %s\n", $error['property'], $error['message']
            );
        }

        if (!empty($message)) {
            $message = self::FAIL_JSON_SCHEMA_MESSAGE . $message;
        }

        return $message;
    }
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;
    }
392150
public function setMessage() {

		$fieldnames = func_get_args();
		$instance	= $this -> getMessageInstance();

		if(0 === count($fieldnames)) {

			foreach($this -> rules as $rule) {
				$fieldnames[$rule -> field] = $rule -> field;
			}
		}	

		foreach($fieldnames as $fieldname) {

			if(false === is_string($fieldname)) {
				return trigger_error(sprintf('All fieldnames used in "%s"() must be of the type string, "%s" given', __METHOD__, gettype($fieldname)), E_USER_ERROR);
			}
		}

		if(count($instance :: getFieldnames()) === 0) {
			$instance :: setFieldnames($fieldnames);
		}

		return $instance;
	}
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;
    }
624715
def _CheckFieldMaskMessage(message):
  """"""
  message_descriptor = message.DESCRIPTOR
  if (message_descriptor.name != 'FieldMask' or
      message_descriptor.file.name != 'google/protobuf/field_mask.proto'):
    raise ValueError('Message {0} is not a FieldMask.'.format(
        message_descriptor.full_name))
1202230
function setErrorResponse($errorNo, $errorDesc) {
    $resultText  = "<CardinalMPI>";
    $resultText = $resultText."<ErrorNo>".($errorNo)."</ErrorNo>" ;
    $resultText = $resultText."<ErrorDesc>".($errorDesc)."</ErrorDesc>" ;
    $resultText  = $resultText."</CardinalMPI>";
    return $resultText;
  }
85269
public void addFieldWarning (@Nonnull @Nonempty final String sFieldName, @Nonnull @Nonempty final String sText)
  {
    add (SingleError.builderWarn ().setErrorFieldName (sFieldName).setErrorText (sText).build ());
  }
343420
def _set_field_on_message(msg, key, value):
    """"""
    # Attempt to set the value on the types of objects we know how to deal
    # with.
    if isinstance(value, (collections_abc.MutableSequence, tuple)):
        # Clear the existing repeated protobuf message of any elements
        # currently inside it.
        while getattr(msg, key):
            getattr(msg, key).pop()

        # Write our new elements to the repeated field.
        for item in value:
            if isinstance(item, collections_abc.Mapping):
                getattr(msg, key).add(**item)
            else:
                # protobuf's RepeatedCompositeContainer doesn't support
                # append.
                getattr(msg, key).extend([item])
    elif isinstance(value, collections_abc.Mapping):
        # Assign the dictionary values to the protobuf message.
        for item_key, item_value in value.items():
            set(getattr(msg, key), item_key, item_value)
    elif isinstance(value, message.Message):
        getattr(msg, key).CopyFrom(value)
    else:
        setattr(msg, key, value)
673986
public function addRequired($field, $errorMsg = null, $validate = self::VALID_NOT_EMPTY)
    {
        $obj = new \stdClass;
        $obj->message = ($errorMsg == null) ? t('Field "%s" is invalid', $field) : $errorMsg;
        $obj->field = $field;
        $obj->validate = $validate;
        $this->fields[] = $obj;
    }
424605
protected function addError($field , $message) {
        if(array_key_exists($field, $this->errors)) {
            $this->errors[$field][] = $message;
        } else {
            $this->errors[$field] = [$message];
        }
        return $this;
    }
569190
private function _constructSignatureFromSnsMessage(Message $snsMessage)
    {
        if (strcmp($snsMessage->getMandatoryField("Type"), "Notification") != 0) {
            throw new OffAmazonPaymentsNotifications_InvalidMessageException(
                "Error with signature verification - unable to verify " .
                $snsMessage->getMandatoryField("Type") . " message"
            );
        }
        
        // get the list of fields that we are interested in
        $fields = array(
            "Timestamp" => true,
            "Message" => true,
            "MessageId" => true,
            "Subject" => false,
            "TopicArn" => true,
            "Type" => true
        );
        
        // sort the fields into byte order based on the key name(A-Za-z)
        ksort($fields);
        
        // extract the key value pairs and sort in byte order
        $signatureFields = array();
        foreach ($fields as $fieldName => $mandatoryField) {
            if ($mandatoryField) {
                $value = $snsMessage->getMandatoryField($fieldName);
            } else {
                $value = $snsMessage->getField($fieldName);
            }
            
            if (!is_null($value)) {
                array_push($signatureFields, $fieldName);
                array_push($signatureFields, $value);
            }
        }
        
        // create the signature string - key / value in byte order
        // delimited by newline character + ending with a new line character
        return implode("\n", $signatureFields) . "\n";
    }
886309
public function getErrorsAsText(): string
    {
        $result = '';
        $fieldCounter = 0;
        $fields = $this->getErrors();

        foreach ($fields as $fieldName => $fieldErrors) {
            $fieldCounter++;
            $result .= "$fieldCounter) $fieldName\n";

            foreach ($fieldErrors as $error) {
                $result .= "   - $error\n";
            }
        }

        return $result;
    }
154822
public function error($field, $error, array $params = null)
    {
        $this->_errors[$field] = [
            $error,
            $params
        ];

        return $this;
    }