Raise ValidationError if the contact exists.
341767
def clean_email(self):
        
        contacts = self.api.lists.contacts(id=self.list_id)['result']

        for contact in contacts:
            if contact['email'] == self.cleaned_data['email']:
                raise forms.ValidationError(
                    _(u'This email is already subscribed'))

        return self.cleaned_data['email']
145494
def validate_or_raise(self, *a, **k):
        
        
        validate, err = self.validate(*a, **k)
        
        if err:
            raise ValidationException(err)
        
        return validate
926956
def check_errors(self, data):
        """"""

        if (type(data) == dict and 'status' in data.keys()
            and data['status'] == 'failed'):
            if data.get('exception_msg') and 'last_id' in data.get('exception_msg'):
                raise PyBossaServerNoKeysetPagination
            else:
                raise Error(data)
        return False
237641
def validate_to_one(self, value):
        

        if value.rid and self.typeness is int:
            validators.validate_int(value)

        if value.rid and not self.skip_exists:
            if not value.load():
                raise ValidationError(self.messages['exists'])
        return value
1251273
def validate(self):
        """"""
        for context_name in self.context_names:
            context = self.context(context_name)
            try:
                context.validate()
            except ResolvedContextError as e:
                raise SuiteError("Error in context %r: %s"
                                 % (context_name, str(e)))
706687
def _check_for_errors(etree: ET.ElementTree):
    """"""
    if etree.getroot().tag == 'error':
        raise APIError(etree.getroot().text)
689979
def ensure_exists(self):
        
        if not self.exists:
            msg = "The local %s repository %s doesn't exist!"
            raise ValueError(msg % (self.friendly_name, format_path(self.local)))
810
def _check_valid_label(self, label):
        """"""
        if len(label.shape) != 2 or label.shape[1] < 5:
            msg = "Label with shape (1+, 5+) required, %s received." % str(label)
            raise RuntimeError(msg)
        valid_label = np.where(np.logical_and(label[:, 0] >= 0, label[:, 3] > label[:, 1],
                                              label[:, 4] > label[:, 2]))[0]
        if valid_label.size < 1:
            raise RuntimeError('Invalid label occurs.')
255497
def validate_required(self, value):
        ''' 
        '''
        if self.required and (value is None or value==''):
            raise MissingFieldError(self.name)
76555
def with_validator(self, validator):
    """"""
    if not callable(validator):
      raise ValueError('Validator must be callable', validator)
    self.validators.append(validator)
    self._cached = None
    return self
210072
def _raise_error_iface(iface, option, expected):
    '''
    
    '''
    msg = _error_msg_iface(iface, option, expected)
    log.error(msg)
    raise AttributeError(msg)
200601
def validate(self):
        
        required_fields = list(filter(lambda x: self._fields[x], self._fields.keys()))
        for field in (self._top_fields + required_fields):
            if not hasattr(self, field) or hasattr(self, field) and getattr(self, field) == None:
                raise MissingFieldError(field)
573172
def validate_receiver(self, key, value):
        """"""
        if value not in current_webhooks.receivers:
            raise ReceiverDoesNotExist(self.receiver_id)
        return value
1273960
function validationMiddleware (err, req, res, next) {
  if (!err instanceof ValidationError) return next(err);
  return res.status(err.status).send({ errors: err.errors });
}
921236
def check_exists_in_object(method, obj, required_fields):
    
    missing = []
    for field in required_fields:
        if getattr(obj, field) is None:
            missing.append(field)
    if missing:
        raise PyCronofyValidationError('Method: %s. Missing auth field(s): %s' % (method, missing),
                                       method,
                                       missing
                                       )
547546
def validate(self, data):
        '''
        '''
        try:
            self._validator.validate(data)
        except jsonschema.ValidationError as e:
            six.raise_from(ValidationError.create_from(e), e)
556832
def raises(cls, sender, attrname, error, args=ANYTHING, kwargs=ANYTHING):
        ""
        def raise_error():
            raise error
        return cls(sender, attrname, returns=Invoke(raise_error), args=ANYTHING, kwargs=ANYTHING)