Raise on unsupported tokens.
424575
def _raise_on_unsupported_token(self, request):
        """"""
        if (request.token_type_hint and
            request.token_type_hint in self.valid_token_types and
            request.token_type_hint not in self.supported_token_types):
            raise UnsupportedTokenTypeError(request=request)
510645
def require(self, *kinds):
        """"""
        token = self.attempt()
        if not token:
            raise SyntaxError('Unexpected end of input')
        if kinds and token.kind not in kinds:
            raise SyntaxError.unexpected(token, kinds)
        return token
1114750
def _re_raise_as(NewExc, *args, **kw):
    """"""
    etype, val, tb = sys.exc_info()
    raise NewExc(*args, **kw), None, tb
217170
def handle_error(self, error, req, schema, error_status_code, error_headers):
        """"""
        status = status_map.get(error_status_code or self.DEFAULT_VALIDATION_STATUS)
        if status is None:
            raise LookupError("Status code {0} not supported".format(error_status_code))
        raise HTTPError(status, errors=error.messages, headers=error_headers)
1263469
def maybe_raise(cls, error_type, ignores=None):
        
        ignores = set(ignores or [])
        ignores.add(ErrorType.Ok)
        if error_type not in ignores:
            raise LibError(error_type)
473962
def raise_on_invalid(self, setting=True, **overrides):
        """"""
        return self.where(raise_on_invalid=setting, **overrides)
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)
365033
def error(self, msg):
        ''''''
        if self.finished():
            raise ConfigParseError("Unexpected end of input; %s" % (msg,))
        else:
            t = self.peek()
            raise ConfigParseError("Unexpected token %s; %s" % (t, msg))
620300
def _prepare_reserved_tokens(reserved_tokens):
  """"""
  reserved_tokens = [tf.compat.as_text(tok) for tok in reserved_tokens or []]
  dups = _find_duplicates(reserved_tokens)
  if dups:
    raise ValueError("Duplicates found in tokens: %s" % dups)
  reserved_tokens_re = _make_reserved_tokens_re(reserved_tokens)
  return reserved_tokens, reserved_tokens_re
472800
def _validate_if_patch_supported(self, headers, uri):
        """"""
        if not self._operation_allowed(headers, 'PATCH'):
                msg = ('PATCH Operation not supported on the resource '
                       '"%s"' % uri)
                raise exception.IloError(msg)
650400
def error(self, msg, previous=False):
        
        token = self.tokens[self.current_token - 1]
        line_no = self.line
        if previous:
            line_no -= 1
        line = self.raw[line_no]
        position = token["start"] - self.line_start
        if previous:
            position = len(line) + 2
        raise ParseException(msg, line, line_no + 1, position, token["value"])
271477
def _raise_for_status(response):
    
    message = ''
    if 400 <= response.status < 500:
        message = '%s Client Error: %s' % (response.status, response.reason)
    elif 500 <= response.status < 600:
        message = '%s Server Error: %s' % (response.status, response.reason)
    else:
        return
    if response.status == 503:
        raise ConnectionError(message)
    if response.headers.get("content-type", "").startswith("application/json"):
        data = json.loads(response.data.decode('utf-8'))
        error = data.get('error', {})
        error_trace = data.get('error_trace', None)
        if "results" in data:
            errors = [res["error_message"] for res in data["results"]
                      if res.get("error_message")]
            if errors:
                raise ProgrammingError("\n".join(errors))
        if isinstance(error, dict):
            raise ProgrammingError(error.get('message', ''),
                                   error_trace=error_trace)
        raise ProgrammingError(error, error_trace=error_trace)
    raise ProgrammingError(message)
1042611
def _handle_token(self, token):
        """"""
        try:
            return _HANDLERS[type(token)](self, token)
        except KeyError:
            err = "_handle_token() got unexpected {0}"
            raise ParserError(err.format(type(token).__name__))
758420
def raise_for_api_error(headers: MutableMapping, data: MutableMapping) -> None:
    

    if not data["ok"]:
        raise exceptions.SlackAPIError(data.get("error", "unknow_error"), headers, data)

    if "warning" in data:
        LOG.warning("Slack API WARNING: %s", data["warning"])
454730
def _raise_deferred_exc(self):
    """"""
    if self._deferred_exception:
      try:
        exc_type, exc_value, exc_traceback = self._deferred_exception
        raise_with_traceback(exc_value, exc_traceback)
      except TypeError:
        # If `_deferred_exception` isn't a 3-item tuple (raising a TypeError on the above
        # destructuring), treat it like a bare exception.
        raise self._deferred_exception
1317394
def _raise_for_status(response):
    '''
    
    '''
    http_error_msg = ""

    if 400 <= response.status_code < 500:
        http_error_msg = "{0} Client Error: {1}".format(response.status_code,
                                                        response.reason)

    elif 500 <= response.status_code < 600:
        http_error_msg = "{0} Server Error: {1}".format(response.status_code,
                                                        response.reason)

    if http_error_msg:
        try:
            more_info = response.json().get("message")
        except ValueError:
            more_info = None
        if more_info and more_info.lower() != response.reason.lower():
            http_error_msg += ".\n\t{0}".format(more_info)
        raise requests.exceptions.HTTPError(http_error_msg, response=response)
660304
def visit_raise(self, node):
        """"""
        if node.exc:
            if node.inst:
                if node.tback:
                    return "raise %s, %s, %s" % (
                        node.exc.accept(self),
                        node.inst.accept(self),
                        node.tback.accept(self),
                    )
                return "raise %s, %s" % (node.exc.accept(self), node.inst.accept(self))
            return "raise %s" % node.exc.accept(self)
        return "raise"