Overrides the base behaviour defined in ValidationError in order to add details about the function.
        :return:
181167
def get_what_txt(self):
        
        return 'input [{var}] for function [{func}]'.format(var=self.get_variable_str(),
                                                            func=self.validator.get_validated_func_display_name())
72249
def validate(self):
        

        spec = self._create_specs()

        # support in future
        functions = {}

        validator = validate.Validator(functions=functions)

        self.config.configspec = spec
        result = self.config.validate(validator, preserve_errors=True)

        if self._parse_result(result):
            return True
477784
def validate(self, input_parameters, context):
        """"""
        errors = {}

        for key, type_handler in self.input_transformations.items():
            if self.raise_on_invalid:
                if key in input_parameters:
                    input_parameters[key] = self.initialize_handler(
                        type_handler,
                        input_parameters[key],
                        context=context
                    )
            else:
                try:
                    if key in input_parameters:
                        input_parameters[key] = self.initialize_handler(
                            type_handler,
                            input_parameters[key],
                            context=context
                        )
                except InvalidTypeData as error:
                    errors[key] = error.reasons or str(error.message)
                except Exception as error:
                    if hasattr(error, 'args') and error.args:
                        errors[key] = error.args[0]
                    else:
                        errors[key] = str(error)
        for require in self.required:
            if not require in input_parameters:
                errors[require] = "Required parameter '{}' not supplied".format(require)
        if not errors and getattr(self, 'validate_function', False):
            errors = self.validate_function(input_parameters)
        return errors
52065
def validate(self, value=None, model=None, context=None):
        
        errors = []
        for validator in self.validators:
            if value is None and not isinstance(validator, Required):
                continue

            error = validator.run(
                value=value,
                model=model,
                context=context if self.use_context else None
            )
            if error:
                errors.append(error)

        return errors
910988
def validate(self, value=_undefined, name=None):
        
        if self.optional:
            if value is _undefined or value is None:
                if self.default is None:
                    return None
                elif util.is_function(self.default):
                    value = self.default()
                else:
                    value = self.default
        elif value is _undefined:
            if name is not None:
                name_msg = "argument `{}`".format(name)
            else:
                name_msg = "unnamed argument"
            raise TypeError("Missing required value for {}".format(name_msg))

        return self.validator(value)
853800
def validate(self):
        
        if getattr(self, '_getting_validated', False):
            return True
        self._getting_validated = True
        self._validation_error_tuples = []
        self._non_validation_error = None
        try:
            for val in itervalues(self._class_validators):
                try:
                    if isinstance(val.func, string_types):
                        valid = getattr(self, val.func)()
                    else:
                        valid = val.func(self)
                    if valid is False:
                        raise utils.ValidationError(
                            'Validation failed', None, None, self
                        )
                except utils.ValidationError as val_err:
                    self._validation_error_tuples += val_err.error_tuples
                except GENERIC_ERRORS as err:
                    if not self._non_validation_error:
                        self._non_validation_error = err
            if self._validation_error_tuples:
                self._error_hook(self._validation_error_tuples)
                msgs = ['Validation failed:']
                msgs += [val.message for val in self._validation_error_tuples]
                raise utils.ValidationError(
                    message='\n- '.join(msgs),
                    _error_tuples=self._validation_error_tuples,
                )
            if self._non_validation_error:
                raise self._non_validation_error                               #pylint: disable=raising-bad-type
            return True
        finally:
            self._getting_validated = False
            self._validation_error_tuples = None
            self._non_validation_error = None
435189
def raise_error(self, message='', errors=None, field_name=None):
        
        field_name = field_name if field_name else self.field_name
        raise ValidationError(message, errors=errors, field_name=field_name)
877661
def __add_callback(self, type_, func, serialised_if_crud=True):
        """"""
        Validation.callable_check(func)
        with self.__callbacks:
            self.__callbacks[type_].append((func, serialised_if_crud))
1262132
def get_details(self):
        

        if isinstance(self.validation_outcome, Exception):
            if isinstance(self.validation_outcome, Failure):
                # do not say again what was the value, it is already mentioned inside :)
                end_str = ''
            else:
                end_str = ' for value [{value}]'.format(value=self.wrong_value)

            contents = 'Function [{wrapped}] raised [{exception}: {details}]{end}.' \
                       ''.format(wrapped=get_callable_name(self.wrapped_func),
                                 exception=type(self.validation_outcome).__name__, details=self.validation_outcome,
                                 end=end_str)
        else:
            contents = 'Function [{wrapped}] returned [{result}] for value [{value}].' \
                       ''.format(wrapped=get_callable_name(self.wrapped_func), result=self.validation_outcome,
                                 value=self.wrong_value)

        return contents
1330233
def _validate(self):
        
        # disable methods matching before validation
        self._disable_patching = True
        # validation by Invariant.validate
        self._validate_base(self)
        # enable methods matching after validation
        self._disable_patching = False
1188702
def add_messages(self, validation):
        
        if not isinstance(validation, Validation):
            raise TypeError("Argument must be of type Validation")

        self.messages.extend(validation.messages)
262292
def extend_with_default(validator_class: Any) -> Any:
    
    validate_properties = validator_class.VALIDATORS['properties']

    def set_defaults(validator: Any,
                     properties: dict,
                     instance: dict,
                     schema: dict) -> Iterator[ValidationError]:
        for prop, subschema in properties.items():
            if 'default' in subschema:
                instance.setdefault(prop, subschema['default'])

        for error in validate_properties(
            validator, properties, instance, schema,
        ):
            yield error  # pragma: no cover

    return extend(validator_class, {'properties': set_defaults})
1259977
def detail_action(**kwargs):
    
    def decorator(func):
        func.action = True
        func.detail = True
        func.kwargs = kwargs
        return func
    return decorator
440376
def expected_error_messages(*error_messages):
    
    def wrapper(func):
        setattr(func, EXPECTED_ERROR_MESSAGES, error_messages)
        return func
    return wrapper
991333
def inherit_errors(error_object)
      error_object = error_object.errors if error_object.respond_to?(:errors)

      error_object.each do |k, v|
        next if _error_ignores[k.to_sym]

        if respond_to?(k)
          errors.add(k, v)
        elsif _error_map[k.to_sym]
          errors.add(_error_map[k.to_sym], v)
        else
          errors.add(:base, error_object.full_message(k, v))
        end
      end

      false
    end
713747
def raises(self, exception_type, function, *args, **kwargs):
        
        try:
            result = function(*args, **kwargs)
            self.log_error("{} did not throw exception {}".format(
                function.__name__,
                exception_type.__name__
            ), None)
            return result
        except Exception as e:
            if type(e) != exception_type:
                self.log_error("{} did raise {}: {}".format(
                    function.__name__,
                    type(e).__name__, e
                ), None)
145601
function BehaviorInterfaceError(baseBehavior, extendingBehavior, missingProps) {
	var extendingName = extendingBehavior.behaviorName || 'anonymous behavior',
		baseName = baseBehavior.__behaviorName || 'anonymous behavior',
		message = 'can-connect: Extending behavior "' + extendingName + '" found base behavior "' + baseName
			+ '" was missing required properties: ' + JSON.stringify(missingProps.related),
		instance = new Error(message);

	if (Object.setPrototypeOf){
		Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
	}
	return instance;
}