def error(self, error_code, value, **kwargs):
code = self.error_code_map.get(error_code, error_code)<EOL>try:<EOL><INDENT>message = Template(self.error_messages[code])<EOL><DEDENT>except KeyError:<EOL><INDENT>message = Template(self.error_messages[error_code])<EOL><DEDENT>placeholders = {"<STR_LIT:value>": self.hidden_value if self.hidden else value}<EOL>placeholders.update(kwargs)<EOL>placeholders.update(self.message_values)<EOL>self.messages[code] = message.safe_substitute(placeholders)<EOL>
Helper to add error to messages field. It fills placeholder with extra call parameters
or values from message_value map.

:param error_code: Error code to use
:rparam error_code: str
:param value: Value checked
:param kwargs: Map of values to use in placeholders